首页 技术 正文
技术 2022年11月11日
0 收藏 799 点赞 2,217 浏览 2264 个字

我的升级环境:旧版Nginx:1.6新版Nginx:1.12.2系统:Redhat 5.5 64位  前期准备1、查看Nginx的安装位置ps -ef |grep nginx  –如果Nginx没在运行,则漏洞为误报,可上报领导。root     19681(PID号)     1  0 10:44 ?        00:00:00 nginx: master process ./nginxhgaop    19682 19681  0 10:44 ?        00:00:00 nginx: worker processroot     22014 21985  0 11:14 pts/1    00:00:00 grep nginx# ll /proc/19681   –513为进程PID号lrwxrwxrwx 1 hgaop hgaop 0 Mar 2 16:20 cwd -> /data/hgaop/test/nginx/sbin –Nginx启动命令位置,/data/hgaop/test/nginx安装路径lrwxrwxrwx 1 hgaop hgaop 0 Mar 2 17:07 exe -> /data/hgaop/test/nginx/sbin/nginx 2、找出相关文件的位置find / -name nginx.pid error.log nginx.lock(我的服务器上面没找到) access.log/data/hgaop/test/nginx/logs/nginx.pid/data/hgaop/test/nginx/logs/error.log/data/hgaop/test/nginx/logs/access.log注意:如果上面找到的文件有些不在安装目录下,则在第四步配置需要指定相关文件的路径,例如:–pid-path=/data/hgaop/test/nginx/logs/nginx.pid \–lock-path=/data/hgaop/test/nginx/logs/nginx.lock \–error-log-path=/data/hgaop/test/nginx/logs/error.log \–http-log-path=/data/hgaop/test/nginx/logs/access.log \
3、可查看Nginx配置文件,看下端口和网站代码的目录等等,然后用浏览器看是否可以登录 升级开始:一、首先查看一下Nginx版本/data/hgaop/test/nginx/sbin/nginx -v 二、下载最新版本的nginx网址:Nginxhttp://nginx.org/) 三、将下载的文件上传到服务器中,解压tar –zxf nginx-1.12.2.tar.gzcd /data/nginx-1.12.2 四、配置可用./configure –help查看相关的配置参数,包括制定openssl或者zlib库的路径等等其中—prefix指定编译的路径。我这里是旧版Nginx的安装路径。告诉编译的Nginx启动文件来这里找nginx.pid,error.log,nginx.lock(我的服务器上面没找到),access.log这四个文件。./configure \–user=hgaop \–group=hgaop \–prefix=/data/hgaop/test/nginx \–with-http_stub_status_module \–with-http_ssl_module 五、执行,这里要主要,是只执行make,不能执行make install,切记!!!!!!# make 六、将sbin下的nginx重命名为nginx.old# mv/data/hgaop/test/nginx/sbin/nginx /data/hgaop/test/nginx/sbin/nginx.old 七、复制编译后的objs目录下的nginx到nginx安装目录的sbin下cd /data/nginx-1.12.2   –执行make的目录cp objs/nginx /data/hgaop/test/nginx/sbin/ 八、这里可以测试一下新复制过来的文件是否生效,如果出现下面的 OK 与 successful为正确即可。如下:# /data/hgaop/test/nginx/sbin/nginx -tnginx: the configuration file /data/hgaop/test/nginx/conf/nginx.conf syntax is ok nginx: configuration file /data/hgaop/test/nginx/conf/nginx.conf test is successful可能出现的错误:提示找不到pid,Nginx.conf或者.log文件。解决:重新在第四步开始。配置要指定pid或者log文件等等(找不到哪个就指定哪个)。如前期准备的第2步说的那样。  九、停止旧版Nginx,把nginx.pid文件修改成nginx.pid.oldbin,随即重新启动nginx,实现不间断升级。# cd /data/hgaop/test/nginx/sbin/# ./nginx.old –s stop  –停止旧版Nginx# ./nginx –直接回车,启动新版Nginx 十、升级完成后,重新查看一下版本即可# /data/hgaop/test/nginx/sbin/nginx -v 十一、去网页访问,网页是否能够打开,查看源代码,看Nginx版本。  

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,082
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,556
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,405
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,179
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,815
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,898