进行简单记录如下
1.安装依赖
yum -y install gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel
2.下载nginx
wget -c https://nginx.org/download/nginx-1.19.0.tar.gz
3.解压缩
tar -zxvf nginx-1.19.0.tar.gz
4.进入解压后目录
cd nginx-1.19.0/
5.编译 带 http_ssl_module 参数
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_sub_module --with-http_gzip_static_module --with-pcre
6.安装
make && make install
7.开机启动
vim /etc/systemd/system/nginx.service
[Unit]
Description=nginx
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s quit
PrivateTmp=true
[Install]
WantedBy=multi-user.target
8.执行指令
chmod +x /etc/systemd/system/nginx.service
systemctl enable nginx.service