Nginx--1.16--web软件

一、yum源安装

http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
nginx.repo上传到/etc/yum.repos.d目录
yum install nginx -y
验证:nginx -v

/bin/systemctl start nginx.service
PID file /var/run/nginx.pid not readable (yet?) after start
但启动成功

解决办法:
/usr/lib/systemd/system/nginx.service
[service]PIDFile下一行增加 ExecStartPost=/bin/sleep 0.1
/bin/systemctl daemon-reload

[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/
After=network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target

[Service]
Type=forking
PIDFile=/var/run/nginx.pid
在这里
ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID

[Install] WantedBy=multi-user.target
/bin/systemctl restart nginx.service

参考:https://www.cnblogs.com/songxingzhu/p/8568432.html


二、源码

下载页面:http://nginx.org/en/download.html 稳定版tar.gz
其他版本:http://nginx.org/download/

升级nginx,为了避免重新部署应用或重新配置的麻烦,最合适的做法是重新编译一个nginx二进制文件,替换旧的nginx二进制文件,然后重启nginx。
与服务器相一致的环境(这里的环境主要指操作系统大版本,插件版本,文件目录)
configure–make–make install,得到sbin/nginx脚本(备份)

nginx -V 得到编译参数(可能没有)
./configure --prefix=
make 在nginx目录下

cp nginx nginx-old-copy 备份替换
nginx -v 查看版本
nginx -s stop
nginx -t nginx.conf 测试配置文件
nginx -c nginx.conf 选择配置文件启动

nginx: error while loading shared libraries: libpcre.so.1:
cannot open shared object file: No such file or directory
在Redhat 64位服务器上,nginx可能读取的pcre文件为/lib64/libpcre.so.1文件,去查看下
解决办法:
增加软链接 ln -s /usr/local/lib/libpcre.so.1 /lib64

主要参考:
https://blog.csdn.net/atongmu2017/article/details/87974699
https://blog.csdn.net/weixin_34342578/article/details/85969841
编译参数:
openssl:https://www.openssl.org/source/
pcre:https://ftp.pcre.org/pub/pcre/
zlib:https://sourceforge.net/projects/libpng/files/zlib/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值