安装以下:

yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel


 

安装以下:

pcre:

wget https://jaist.dl.sourceforge.net/project/pcre/pcre/8.42/pcre-8.42.tar.gz

tar -xvf pcre-8.42.tar.gz

cd pcre-8.42

./configure

make && make install 


 

nginx:

wget http://nginx.org/download/nginx-1.9.9.tar.gz

tar -xvf nginx-1.9.9.tar.gz

cd nginx-1.9.9

./configure --prefix=/usr/local/nginx  --with-http_stub_status_module --with-http_ssl_module --with-pcre=/root/pcre-8.42

make && make install

/usr/local/nginx/sbin/nginx -v


 

创建启动服务

vi /lib/systemd/system/nginx.service


[Unit]

Description=nginx

  

[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


 

创建开机启动

systemctl enable nginx.service


 

启动命令
systemctl start nginx.service 

 

防止出现  Warning: nginx.service changed on disk. Run 'systemctl daemon-reload' to reload units.  执行下面的命令

systemctl daemon-reload

posted on 2020-07-16 15:57  田坤坤  阅读(138)  评论(0编辑  收藏  举报