下載nginx包,具體版本查看Nginx官方下載地址。
wget http://nginx.org/download/nginx-1.17.10.tar.gz
一些編譯安裝要用到的依賴包
gcc gcc-c++ make pcre-devel zlib-devel openssl-devel
openssl-devel(用於加密)
常用插件
--prefix=/usr/local/nginx \
--user=nginx \
--group=nginx \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-http_flv_module \
--with-http_gzip_static_module
--prefix=/usr/local/nginx(指定安裝路徑)
--user=nginx --group=nginx(指定運行用戶和組)
--with-http_stub_status_module(啟用該模塊以支持狀態統計)
--with-http_ssl_module(啟用SSL模塊)
--with-http_flv_module(啟用FLV模塊,提供尋求內存使用基於時間的偏移量文件)
--with-http_gzip_static_module(預讀gzip功能)
常用插件2 (內含stream模塊反向代理)
--prefix=/usr/local/nginx \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gzip_static_module \
--with-stream \
--with-stream_realip_module \
--with-stream_ssl_module && make && make install