1、下載nginx安裝包,官網地址:http://nginx.org/download/
2、安裝編譯工具及庫檔案
yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel pcre-devel
3、安裝nginx,建議開啟ssl模式,否則後續配置https還需要重新編譯
#編譯
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
#安裝
make && make install
4、啟動nginx
cd /usr/local/nginx/sbin
啟動:./nginx
重啟:./nginx -s reload
校驗配置:./nginx -t
更多nginx的配置,可參考 https://blog.csdn.net/weixin_50367873/article/details/114821637