天天看點

Nginx 快速安裝手冊及如何修改端口号

安裝openssl-0.9.8e.tar.gz軟體包

./configure  --prefix=/usr/local/openssl

make &&make install

2) 安裝pcre-8.12.tar.gz軟體包(可以安裝CD光牒裡面pcre和pcre-devel,prce庫支援Nginx HttpRewrite子產品)

./configure --prefix=/usr/local/prce

3) 安裝nginx軟體包

 useradd david -s /sbin/nologin

./configure

 --user=david --group=david    /指定nginx運作的nginx使用者群組

 --prefix=/usr/local/nginx/    

 --with-http_stub_status_module --with-openssl=/usr/local/openssl

 --with-pcre=/usr/local/pcre/

make && make install

測試nginx 服務是否安裝成功

/usr/local/nginx/sbin/nginx -t 

nginx: the configuration file /usr/local/nginx//conf/nginx.conf syntax is ok

nginx: configuration file /usr/local/nginx//conf/nginx.conf test is successful

5) 啟動nginx 服務

/usr/local/nginx/sbin/nginx  

6) 檢視nginx 是否開啟(即檢視nginx的端口是否處于LISTEN)

netstat -antl

7) 關閉nginx服務

[root@nagios ~]# ps -auxw |grep "nginx" |grep -v "grep"

Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ

root      5115  0.0  0.0   4112   456 ?        Ss   21:42   0:00 nginx: master process /usr/local/nginx/sbin/nginx

david     5116  0.0  0.2   4284  1072 ?        S    21:42   0:00 nginx: worker process      

kill -9 程序号

8) 修改nginx端口号

server {

Listen 改一下就OK了

}

本文轉自 sfzhang 51CTO部落格,原文連結:http://blog.51cto.com/sfzhang88/851994,如需轉載請自行聯系原作者

繼續閱讀