How to upgrade Nginx does not affect the old configuration?

Source: Internet
Author: User

First Download Nginx: execute wget

Run again./configure -- user = www -- group = www -- prefix =/usr/local/nginx -- with-http_stub_status_module -- with-http_ssl_module -- with-http_gzip_static_module.

Then make, but do not make install
After compilation, there is an nginx execution file under the objs directory.

Back up old nginx files

Mv/usr/local/nginx/sbin/nginx. old

Run cp objs/nginx/usr/local/nginx/sbin/nginx after converting nginx cp under the new objs to sbin.

Run the/usr/local/nginx/sbin/nginx-t test to check whether there is any problem.

Run make upgrade again.

Run:/usr/local/nginx/sbin/nginx-V to display the nginx version and compiled parameters.

The above is a copy of others' upgrade methods. I will share my operation process with you.

The procedure is as follows:
1. Check the current version and download the latest stable nginx version:

The code is as follows: Copy code

[Root @ localhost ~] # Nginx-v
Nginx: nginx version: nginx/1.0.11

2. Decompress and compile after the download is completed:

Compiling Environment:

The code is as follows: Copy code

Yum install gcc openssl-devel pcre-devel zlib-devel

Back up the original nginx website:

The code is as follows: Copy code


That is, you can specify the backup directory.

The code is as follows: Copy code

Tar zxvf nginx-1.0.12.tar.gz
Cd nginx-1.0.12
. /Configure -- prefix =/usr/share -- sbin-path =/usr/sbin/nginx -- conf-path =/etc/nginx. conf -- error-log-path =/var/log/nginx/error. log -- pid-path =/var/run/nginx. pid -- lock-path =/var/lock/nginx. lock -- user = nginx -- group = nginx -- with-http_ssl_module -- with-http_flv_module -- with-http_gzip_static_module -- with-http_stub_status_module

Never make install

3. After compilation, we start to upgrade.

The code is as follows: Copy code

Mv/usr/sbin/nginx/usr/sbin/nginx0214 & amp; cp./objs/nginx/usr/sbin/nginx
[Root @ localhost ~] # Nginx-V
Nginx: nginx version: nginx/1.0.12

Reload nginx

The code is as follows: Copy code

/Usr/sbin/nginx-s reload


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.