1.下載Nginxd安裝包
Nginx官網查看Nignx版本,找到stable版本下載
wget -c https://nginx.org/download/nginx-1.16.0.tar.gz
解壓安裝包:tar -zxvf nginx-1.16.0.tar.gz
2.配置Nginx
root用戶執行
>yum install gcc-c++ -y
>yum install zlib zlib-devel -y
>yum install pcre pcre-devel -y
>yum install openssl openssl-devel -y
>./configure
>make install
>whereis nginx
3.Nginx啟停
>cd /usr/local/nginx/sbin
--啟動
>./nginx
--查出Nginx進程id,然后使用kill命令強制殺掉進程
>./nginx -s stop
--待Nginx進程處理完任務再進行停止
>./nginx -s quit
--重新加載配置文件使其生效
>./nginx -s reload
查看nginx進程
>ps -ef | grep nginx
[root@pgdb_slave sbin]# ps -ef | grep nginx
root 61636 1 0 23:01 ? 00:00:00 nginx: master process ./nginx
nobody 61637 61636 0 23:01 ? 00:00:00 nginx: worker process
root 61641 53355 0 23:06 pts/0 00:00:00 grep --color=auto nginx
3.修改Nginx端口號
>cd /usr/local/nginx/conf
>cp nginx.conf nginx.confbak
>vim nginx.conf
修改server項內的端口號
>./nginx -s reload
--重啟
>./nginx -s quit
>./nginx
4.配置開機啟動
>echo "/usr/local/nginx/sbin" >> /etc/rc.local
5.登錄頁面
ip:port