Nginx: installation and configuration of nginx servers

Source: Internet
Author: User

Bytes -----------------------------------------------------------------------------------------------

Nginx: http://www.nginx.net

[Email protected] Black Eye poet <www. chenwei. ws> ----------------------

Install nginx in the window => 'start'-'run'-'cmd' and execute the following doscommand

D:

Cd d: \ nginx

Start nginx

Process Management: nginx-s [Stop | quit | reopen | reload]

 

Install nginx in Linux => install nginx by compiling the source code

Tar zxvf nginx-1.x.xx.tar.gz

CD nginx-1.x.xx

./Configure

Make & make install

Run the preceding command to install nginx in the/usr/local/nginx directory by default. Run the./configure -- Help Command to view the compilation options that can be selected by nginx.

Bytes -----------------------------------------------------------------------------------------------

Nginx startup =>/usr/local/nginx/sbin/nginx-C/usr/local/nginx/CONF/nginx. conf

 

Nginx stop => first use the ps command to find the main process Number of nginx (PS-Ef | grep nginx)

  

Note: The master process indicates the master process, and the process number is 1477; The worder process indicates the sub-process.

1. Stop nginx with ease (kill-Quit nginx main process number)

  

2. Stop nginx (kill-term nginx master process number) and kill-term 1477

3. Force stop all nginx (pkill-9 nginx)

 

Smooth restart of nginx =>/usr/local/nginx/sbin/nginx-s reload (it is recommended that you stop the restart first)

Bytes ----------------------------------------------------------------------------------------------

Signals supported by nginx:

Quickly disable term and int

Close quit

Hup restarts smoothly and reloads the configuration file.

Usr1 re-opens the log file, which is of great use in log cutting.

Usr2 smooth upgrade executable program

Winch calmly closes the Working Process

Bytes ----------------------------------------------------------------------------------------------

Nginx smooth upgrade (reference) => replace the earlier version of the executable program with the nginx executable program re-compiled in the new version without interrupting the service.

1. For nginx compiled and installed, You can compile and install the new version to the nginx installation path of the current version. Back up the nginx installation path before replacement.

2. Kill-The nginx master process Number of the earlier version of usr2

3. Rename the main process file of nginx, execute the new version of nginx executable program, and start the new main process and new working process in sequence.

4. Stop nginx instances of the old version and kill-Winch nginx master process Number of the old version.

5. After a period of time, the old worder process processes all connected requests and then exits, which will be handled by the new worker process.

6. kill-HUP the old master process number: Start the working process without reloading the configuration file.

Kill-new master process Number of quit: Kill the Worker Process with ease

Kill-term new master process number: Force exit

Kill a new master process number or old master process number: Send a kill signal to a new worker process that cannot exit

Bytes ----------------------------------------------------------------------------------------------

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: info-contact@alibabacloud.com 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.