Nginx原始碼安裝

2022-09-12 00:21:38 字數 2929 閱讀 1094

一、環境:

centos6.5

pcre-8.42

nginx 1.62

二、依賴和庫檔案安裝

# yum -y install

make zlib zlib-devel gcc-c++ libtool openssl openssl-devel

三、pcre安裝
[root@master pcre-8.42]# cd /local/

[root@master local]# pwd

/local

[root@master local]# ls pcre-8.42.zip

pcre-8.42.zip

[root@master local]# unzip pcre-8.42.zip

[root@master local]# cd pcre-8.42

[root@master pcre-8.42]# ./configure

[root@master pcre-8.42]# make && make install

四、安裝nginx

[root@master local]# wget

[root@master nginx]# pwd

/opt/nginx

4.2 安裝

4.3 檢視版本

[root@master nginx]#  /opt/webserver/nginx/sbin/nginx -v

nginx version: nginx/1.6.2

4.4 配置nginx

[root@master nginx]# vi /opt/webserver/nginx/conf/nginx.conf  

[root@master nginx]# cat /opt/webserver/nginx/conf/nginx.conf

user www www;

worker_processes

2; #設定值和cpu核心數一致

error_log

/opt/webserver/nginx/logs/nginx_error.log crit; #日誌位置和日誌級別

}}

4.5 測試安裝的正確性

[root@master nginx]# /opt/webserver/nginx/sbin/nginx -t

nginx: the configuration file /opt/webserver/nginx/conf/nginx.conf syntax is ok

nginx: configuration file /opt/webserver/nginx/conf/nginx.conf test is successful

五 、啟動nginx

[root@master nginx]#  /opt/webserver/nginx/sbin/nginx

前端檢視一下:

或者

六、 其他

6.1 命令

/opt/webserver/nginx/sbin/nginx -s reload            # 重新載入配置檔案/opt/webserver/nginx/sbin/nginx -s reopen            # 重啟 nginx/opt/webserver/nginx/sbin/nginx -s stop              # 停止 nginx

6.2 程序檢視

[root@master nginx]# ps -ef|grep nginx

root 14443 1 0 23:32 ? 00:00:00 nginx: master process /opt/webserver/nginx/sbin/nginx 

www 14444 14443 0 23:32 ? 00:00:00 nginx: worker process 

www 14445 14443 0 23:32 ? 00:00:00 nginx: worker process 

root 14479 2276 0 23:56 pts/0 00:00:00 grep nginx

6.3 埠檢視:

[root@master nginx]# netstat -ntl

active internet connections (only servers)

proto recv-q send-q local address foreign address state 

tcp 0 0 0.0.0.0:80 0.0.0.0:* listen

nginx原始碼安裝

nginx原始碼安裝 安裝環境 作業系統 ubuntu 12.04 nginx v1.4.2 pcre v8.33 zlib v1.2.8 1.安裝zlib 1 解壓縮 plain tdtc100 ubuntu tar zxvf zlib 1.2.8.tar.gz 2 安裝 plain tdtc10...

Nginx原始碼安裝

解壓 tar zxvf nginx 1.10.0.tar.gz 執行下面的命令安裝nginx的依賴庫 yum y install gcc pcre pcre devel zlib zlib devel openssl openssl devel我這裡只配置安裝到 opt目錄下,其它選項可執行.con...

nginx 原始碼安裝

缺少 pcre 安裝包 筆者用的是ubuntu apt install libpcre3 libpcre3 dev 缺少 openssl 安裝包 筆者用的是ubuntu apt install openssl apt install libssl dev 再次執行 nginx 指令碼內容 1 bin...