






















[root@lab10 ~]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
[root@lab10 ~]# ip address show ens32
2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:ec:f2:1b brd ff:ff:ff:ff:ff:ff
inet 10.1.1.10/24 brd 10.1.1.255 scope global ens32
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:feec:f21b/64 scope link
valid_lft forever preferred_lft forever
mkdir -p /opt/nginx
下载链接:https://nginx.org/download/nginx-1.26.2.tar.gz
文件全称:nginx-1.26.2.tar.gz
文件md5:1588676BE2A01A63D3A150FAE6C3F4A9
将上述 下载 的5个安装包上传至 /opt/nginx
yum -y install make gcc pcre-devel openssl-devel zlib-devel perl-ExtUtils-Embed
nginx 用户useradd -s /sbin/nologin -r nginx
cd /opt/nginx
tar -zxvf nginx-1.26.2.tar.gz
cd /opt/nginx/nginx-1.26.2
./configure \
--user=nginx \
--group=nginx \
--with-stream \
--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_ssl_module \
--with-stream_realip_module \
--with-file-aio
make
make install
echo "/usr/local/nginx/sbin:${PATH}" > /etc/profile.d/nginx.sh
vim /lib/systemd/system/nginx.service
[Unit]
Description=The nginx HTTP and reverse proxy server
Documentation=http://nginx.org/en/docs/
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PidFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/bin/kill -s hup $mainpid
ExecStop=/bin/kill -s quit $mainpid
PrivateTmp=true
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable --now nginx
浏览器访问 https://10.1.1.10 ,效果如下

参考链接:
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。