1. 程式人生 > >centos7下Nginx安裝

centos7下Nginx安裝

1、安裝依賴和相關庫:

[[email protected] ~]# yum -y install gcc-c++ zlib-devel openssl-devel libtool

2、下載nginx安裝包並解壓:

[[email protected] ~]# cd /usr/loal
[[email protected] local]# wget http://nginx.org/download/nginx-1.14.0.tar.gz
[[email protected] local]# tar -zxvf nginx-1.14.0.tar.gz

3、配置和安裝

[[email protected] local]# cd nginx-1.14.0
[[email protected] nginx-1.14.0]# ./configure 
[[email protected] nginx-1.14.0]# make && make install

4、啟動nginx:

[[email protected] nginx-1.14.0]# cd ../nginx/sbin
[[email protected] sbin]# ./nginx

5、檢視nginx:

[[email protected]
nginx]# ps -ef | grep nginx root 13850 1 0 17:01 ? 00:00:00 nginx: master process ./nginx nobody 13851 13850 0 17:01 ? 00:00:00 nginx: worker process root 13879 1128 0 17:11 pts/0 00:00:00 grep --color=auto nginx

6、停止和重啟nginx:

./nginx -s reload   #重啟
./nginx -s stop #關閉