Nginx installation and upgrade

                                                                                                                                                                                                                  Nginx


Before introducing nginx, first understand the common web servers on the market


Currently commonly used web servers:

(1) Under Unix and Linux platforms

          ——Apache,Nginx,Tengine,Lighttpd

          ——Tomcat,IBM WebSphere,Jboss


(2) Under Windows platform

          - Microsoft's TTS (Internet Information Server)


Introduction to nginx:

     It is a very lightweight HTTP server written by Russians. It is a high-performance HTTP and response proxy server, as well as an IMAP/POP3/SMTP proxy server.


nginx installation and general settings


Step 1: Build the Nginx server


1) Install the nginx package using the source package


# yum -y install gcc pcre-devel openssl-devel make [Install dependency packages]

# useradd -s /sbin/nologin nginx [Create a user for the specified]

# tar -xf nginx-1.10.3.tar.gz [unzip the package]

# cd nginx-1.10.3 [Enter the decompressed software directory]

# ./configure \ [Configure the software]

> --prefix=/usr/local/nginx \ [Specify the installation path [If you don't need to specify a directory, you can leave it out]]

> --user=nginx \ [specified user]

> --group=nginx \ [specify group]

> --with-http_ssl_module [Enable SSL encryption [must be enabled if encryption is required]]

# make 【Compile】

# make install [installation]


2) Usage of nginx command


# /usr/local/nginx/sbin/nginx [Start service]

# /usr/local/nginx/sbin/nginx -s stop [Close the service]

# /usr/local/nginx/sbin/nginx -s reload [To reload the configuration file, the service must be enabled, otherwise an error will be reported]

# /usr/local/nginx/sbin/nginx –V [View software information]

# ln -s /usr/local/nginx/sbin/nginx /sbin/ [Add this command to a soft link for later use]


**The role of the specified user:

     1. Use ordinary users to install nginx software, and only include ordinary users' permissions at startup.

********************************************************************************************************


Step 2: Upgrade nginx

    

1) Compile the new version of nginx software


# tar  -zxvf   nginx-1.12.2.tar.gz

# cd nginx-1.12.2

# ./configure   \

> --prefix=/usr/local/nginx   \ 

> --user=nginx   \ 

> --group=nginx  \ 

> --with-http_ssl_module

# make   


2) Backup the old version and replace the old version with the compiled new version


# mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginxold [Change the name is still stored in the local path]

# cp objs/nginx /usr/local/nginx/sbin/ [Copy the new version to this directory]

# ls /usr/local/nginx/sbin/

  nginx  nginxold

# make upgrade [to upgrade]

# /usr/local/nginx/sbin/nginx -V [View version]


summary:

The steps are basically the same, first decompress the new version of the software package, then configure [the same as the old nginx configuration, you can view the old version configuration with nginx -V], and then compile without installation [because the installation will overwrite the contents of the old version file], after the compilation is completed A new version of the software directory will be generated. After backing up the old version, move the new version to the old version directory, and then upgrade. When the version is new, the upgrade is completed.


make upgrade error exclusion.

Error: make: *** No rules to create target 'upgrade'. stop

If the above error occurs, in order to execute the command that is not in the new version software directory, you need to switch to the directory to execute.

[root@fuwu nginx-1.12.2]# pwd

/lnmp_soft/nginx-1.12.2



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325321707&siteId=291194637