一、下载安装
[root@rocky86-101 ~]
下载安装包
[root@rocky86-101 ~]
安装依赖包
[root@rocky86-101 ~]
创建用户
[root@rocky86-101 ~]
创建文件夹
[root@rocky86-101 ~]
解压
[root@rocky86-101 ~]
[root@rocky86-101 ~]
[root@rocky86-101 nginx-1.22.0]
auto CHANGES CHANGES.ru conf configure contrib html LICENSE man README src
[root@rocky86-101 nginx-1.22.0]
--prefix=/apps/nginx \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--with-pcre \
--with-stream \
--with-stream_ssl_module \
--with-stream_realip_module
查看CPU核数
[root@rocky86-101 nginx-1.22.0]
2
多核心编译
[root@rocky86-101 nginx-1.22.0]
安装
[root@rocky86-101 nginx-1.22.0]
增加环境变量
[root@rocky86-101 nginx-1.22.0]
执行生效
[root@rocky86-101 nginx-1.22.0]
安装目录授权
[root@rocky86-101 sbin]
查看版本
[root@rocky86-101 nginx-1.22.0]
nginx version: nginx/1.22.0
二、 创建 Nginx 自启动文件
[root@rocky86-101 sbin]
[Unit]
Description=The nginx HTTP and reverse proxy server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/apps/nginx/logs/nginx.pid
ExecStartPre=/bin/rm -f /apps/nginx/logs/nginx.pid
ExecStartPre=/apps/nginx/sbin/nginx -t
ExecStart=/apps/nginx/sbin/nginx
ExecReload=/bin/kill -s HUP \$MAINPID
KillSignal=SIGQUIT
TimeoutStopSec=5
KillMode=process
PrivateTmp=true
LimitNOFILE=100000
[Install]
WantedBy=multi-user.target
EOF
[root@rocky86-101 sbin]
[root@rocky86-101 sbin]
查看
[root@rocky86-101 sbin]
[root@rocky86-101 sbin]
客户端访问
[root@rocky86-100 ~]