yum -y install gcc automake autoconf libtool make pcre pcre-devel zlib zlib-devel openssl openssl-devel
wget http:
//10.5.15.22/centos/Nginx-1.14.2.tar.gz
tar xf Nginx-
1.14
.
2
.tar.gz -C /opt/
cd /opt/Nginx-
1.14
.
2
/
useradd -u
601
Nginx -s /sbin/nologin -M
sed -i
's@1.14.2@1.0.0@g'
./src/core/Nginx.h
sed -i
's@"Nginx/"@"apache/"@g'
./src/core/Nginx.h
sed -i
'22s@"Nginx"@"APACHE"@g'
./src/core/Nginx.h
sed -i
'49s#Nginx#apache#g'
./src/http/ngx_http_header_filter_module.c
sed -i
'36s#Nginx#apache#gp'
./src/http/ngx_http_special_response.c
./configure --prefix=/hm/app/Nginx --sbin-path=/hm/app/Nginx/sbin/Nginx --conf-path=/hm/app/Nginx/conf/Nginx.conf --error-log-path=/hm/log/Nginx/error.log --http-log-path=/hm/log/Nginx/access.log --pid-path=/run/Nginx.pid --user=Nginx --group=Nginx --with-http_ssl_module --with-http_stub_status_module --with-pcre --with-http_v2_module --with-stream --with-http_gzip_static_module
make && make install
cp -a /hm/app/Nginx/sbin/Nginx /usr/local/bin/
firewall-cmd --zone=
public
--add-port=
80
/tcp --permanent
firewall-cmd --zone=
public
--add-port=
443
/tcp --permanent
firewall-cmd --reload
#使用systemctl管理Nginx
cat <<efo> /usr/lib/systemd/system/Nginx.service
[Unit]
Description=The Nginx HTTP and reverse proxy server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/run/Nginx.pid
# Nginx will fail to start
if
/run/Nginx.pid already exists but has the wrong
# SELinux context. This might happen when running `Nginx -t` from the cmdline.
# https:
//bugzilla.redhat.com/show_bug.cgi?id=1268621
ExecStartPre=/usr/bin/rm -f /run/Nginx.pid
ExecStartPre=/hm/app/Nginx/sbin/Nginx -t
ExecStart=/hm/app/Nginx/sbin/Nginx
ExecReload=/bin/kill -s HUP $MAINPID
KillSignal=SIGQUIT
TimeoutStopSec=
5
KillMode=process
PrivateTmp=
true
LimitCORE=infinity
LimitNOFILE=
10240
LimitNPROC=
10240
[Install]
WantedBy=multi-user.target
efo
Nginx-1.20.1
yum -y install gcc automake autoconf libtool make pcre pcre-devel zlib zlib-devel openssl openssl-devel
wget http:
//10.5.15.22/centos/Nginx-1.20.1.tar.gz
tar xf Nginx-
1.20
.
1
.tar.gz -C /opt/
cd /opt/Nginx-
1.20
.
1
/
useradd -u
601
Nginx -s /sbin/nologin -M
sed -i
's@1.20.1@1.0.0@g'
./src/core/Nginx.h
sed -i
's@"Nginx/"@"apache/"@g'
./src/core/Nginx.h
sed -i
'22s@"Nginx"@"APACHE"@g'
./src/core/Nginx.h
sed -i
'49s#Nginx#apache#g'
./src/http/ngx_http_header_filter_module.c
./configure --prefix=/hm/app/Nginx --sbin-path=/hm/app/Nginx/sbin/Nginx --conf-path=/hm/app/Nginx/conf/Nginx.conf --error-log-path=/hm/log/Nginx/error.log --http-log-path=/hm/log/Nginx/access.log --pid-path=/run/Nginx.pid --user=Nginx --group=Nginx --with-http_ssl_module --with-http_stub_status_module --with-pcre --with-http_v2_module --with-stream --with-http_gzip_static_module
make && make install
cp -a /hm/app/Nginx/sbin/Nginx /usr/local/bin/
firewall-cmd --zone=
public
--add-port=
80
/tcp --permanent
firewall-cmd --zone=
public
--add-port=
443
/tcp --permanent
firewall-cmd --reload
#使用systemctl管理Nginx
cat <<efo> /usr/lib/systemd/system/Nginx.service
[Unit]
Description=The Nginx HTTP and reverse proxy server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/run/Nginx.pid
# Nginx will fail to start
if
/run/Nginx.pid already exists but has the wrong
# SELinux context. This might happen when running `Nginx -t` from the cmdline.
# https:
//bugzilla.redhat.com/show_bug.cgi?id=1268621
ExecStartPre=/usr/bin/rm -f /run/Nginx.pid
ExecStartPre=/hm/app/Nginx/sbin/Nginx -t
ExecStart=/hm/app/Nginx/sbin/Nginx
ExecReload=/bin/kill -s HUP $MAINPID
KillSignal=SIGQUIT
TimeoutStopSec=
5
KillMode=process
PrivateTmp=
true
LimitCORE=infinity
LimitNOFILE=
10240
LimitNPROC=
10240
[Install]
WantedBy=multi-user.target
efo
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。