
sudo yum install -y gcc-c++ pcre-devel zlib-devel openssl-devel wgetcd /opt
sudo wget http://nginx.org/download/nginx-1.20.2.tar.gz
sudo tar -zxvf nginx-1.20.2.tar.gz
cd nginx-1.20.2./configure --user=root --group=root --prefix=/data/app/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-pcre --with-stream安装多模块
./configure --prefix=/data/nginx --pid-path=/data/nginx/run/nginx.pid --user=root --group=root --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_modulesudo make
sudo make installvim /usr/lib/systemd/system/nginx.service
[Unit]
Description=The Nginx HTTP and reverse proxy server
After=network.target
[Service]
Type=forking
PIDFile=/data/nginx/run/nginx.pid
ExecStartPre=/data/nginx/sbin/nginx -t
ExecStart=/data/nginx/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target保存并退出。
sudo systemctl daemon-reloadsudo systemctl start nginx
sudo systemctl enable nginxnginx -v
sudo systemctl status nginx