Nginx基本安裝配置

kumu_linux發表於2012-06-21

安裝

# yum install pcre* -y
# tar xf nginx-1.2.1.tar.gz
# cd nginx-1.2.1
# ./configure --with-http_stub_status_module --prefix=/usr/local/nginx --with-http_gzip_static_module
# make && make install

[root@server ~]# cd /usr/local/nginx/
[root@server nginx]# ls
conf html logs sbin
[root@server nginx]# ./sbin/nginx -V //-V檢視編譯時候的引數
nginx version: nginx/1.2.1
configure arguments: --with-http_stub_status_module --prefix=/usr/local/nginx --with-http_gzip_static_module
//--with-http_stub_status_module --> 啟用NginxStatus,以監控Nginx的當前狀態
//--with-http_gzip_static_module --> 這個模組支援線上實時輸出資料壓縮
[root@server nginx]# 

[root@server 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
[root@server nginx]#

啟動、關閉、重啟
啟動
[root@server nginx]# ./sbin/nginx
[root@server nginx]# ps -e | grep nginx
7531 ? 00:00:00 nginx
7532 ? 00:00:00 nginx

參考如下命令:

關閉

--> kill -XXX pid

[root@server nginx]# ps -ef | grep "nginx: master process" | grep -v "grep" | awk -F' ' '{print $2}'
7531
[root@server nginx]# cat /usr/local/nginx/logs/nginx.pid
7531
[root@server nginx]#
使用kill即可


重啟

[root@server nginx]# kill -HUP `cat /usr/local/nginx/logs/nginx.pid `


Nginx相關

Nginx安裝配置:點選開啟連結

Nginx虛擬主機配置:點選開啟連結


相關文章