一有咨、 安裝編譯工具及庫(kù)文件
yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel
二琐簇、 下載nginx
https://nginx.org/en/download.html
圖片.png
三、 編譯安裝
./configure --prefix=/usr/local/nginx/
make && make install
四座享、 常用命令
- 找出nginx 進(jìn)程號(hào)
ps -ef | grep nginx
[root@iZhp3349o7pntezql2q5puZ nginx-1.18.0]# ps -ef |grep nginx
root 13579 11009 0 23:38 pts/0 00:00:00 grep --color=auto nginx
root 21819 1 0 Apr03 ? 00:00:00 nginx: master process ./sbin/nginx
root 21820 21819 0 Apr03 ? 00:00:00 nginx: worker process
- 測(cè)試配置文件
./nginx -t
[root@iZhp3349o7pntezql2q5puZ nginx]# pwd
/usr/local/nginx
[root@iZhp3349o7pntezql2q5puZ 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
- 啟動(dòng)nginx
./nginx
指定配置文件啟動(dòng)
./nginx -c /user/local/nginx/conf/nginx.conf
- 關(guān)閉nginx
立即關(guān)閉
kill -TERM 主pid
kill -9 主pid
- 優(yōu)雅關(guān)閉
kill -QUIT 主pid
- 重啟
./ningx -s reload
[root@iZhp3349o7pntezql2q5puZ nginx]# pwd
/usr/local/nginx
[root@iZhp3349o7pntezql2q5puZ 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@iZhp3349o7pntezql2q5puZ nginx]# ./sbin/nginx -s reload
[root@iZhp3349o7pntezql2q5puZ nginx]#
- 查看nginx 版本號(hào)
./nginx -v
[root@iZhp3349o7pntezql2q5puZ nginx]# ./sbin/nginx -v
nginx version: nginx/1.10.2
[root@iZhp3349o7pntezql2q5puZ nginx]#
- 查看nginx 版本號(hào)及編譯信息
./nginx -V
[root@iZhp3349o7pntezql2q5puZ nginx]# pwd
/usr/local/nginx
[root@iZhp3349o7pntezql2q5puZ nginx]# ./sbin/nginx -V
nginx version: nginx/1.10.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module --with-http_dav_module --with-file-aio --with-http_dav_module --add-module=../ngx_devel_kit-0.2.19/ --add-module=../lua-nginx-module-0.10.13/
[root@iZhp3349o7pntezql2q5puZ nginx]#