升级前,查看已经安装的版本以及模块
[root@mail ~]# /opt/nginx/sbin/nginx -Vnginx version: nginx/0.5.34 built by gcc 3.4.6 20060404 (Red Hat 3.4.6-3)configure arguments: --prefix=/opt/nginx --sbin-path=/opt/nginx/sbin/nginx --conf-path=/opt/nginx/conf/nginx.conf --pid-path=/var/run/nginx/nginx.pid --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/opt/nginx/temp/proxy --http-fastcgi-temp-path=/opt/nginx/temp/fcgi --lock-path=/var/run/nginx/nginx.lock --with-http_ssl_module --with-http_sub_module --with-http_stub_status_module --with-debug
修改版本号:
[root@ns ~/nginx-1.7.8]#vim src/core/nginx.h
#define nginx_version 1007008 #define NGINX_VERSION "1.7.8" #define NGINX_VER "nginx/" NGINX_VERSION修改为 #define nginx_version 1007008 #define NGINX_VERSION "1.7.8" #define NGINX_VER "Power_nginx"
然后重新编译:
./configure --prefix=/opt/nginx \--sbin-path=/opt/nginx/sbin/nginx \--conf-path=/opt/nginx/conf/nginx.conf \--pid-path=/var/run/nginx/nginx.pid \--error-log-path=/var/log/nginx/error.log \--http-log-path=/var/log/nginx/access.log \--http-proxy-temp-path=/opt/nginx/temp/proxy \--http-fastcgi-temp-path=/opt/nginx/temp/fcgi \--lock-path=/var/run/nginx/nginx.lock \ --with-http_ssl_module \ --with-http_sub_module \ --with-http_gzip_static_module \ --with-http_stub_status_module \ --with-http_flv_module \--with-debug
make && make install
然后重新启动nginx
service nginx restart
再查看版本及模块信息
完成了。
转载于:https://blog.51cto.com/professor/1596058