Basic usage of Linux Nginx

Source: Internet
Author: User

Nginx-s reload-p <nginx Environment directory >-c < specified configuration file >

Where-p-c is optional, does not write as default path and configuration

Before executing the command, you can

Nginx-t-p<>-c<>

Check that the custom configuration file is correct

In addition nginx Stop command for

PS grep Nginx

Kill 30439<pid>

30439 for the example in the diagram, the PID of Nginx master process

Start the command again

Nginx-p<>-c<>

There's a pit for the reload command only support changes to the configuration file, does not support the change of files, such as the current running configuration file is nginx.conf, and then I modify this file and then reboot no problem

Nginx-s reload-c conf/nginx.conf

But if I want to switch to conf/nginx.other.conf,

Nginx-s reload-c conf/nginx.other.conf

This is not in effect, he still re-read the original file configuration

So if there are multiple profiles that need to be switched, my approach is to rename the configuration file and change the desired profile name to nginx.conf

MV nginx.other.conf nginx.conf

Actually, it's for the blue-green switch.

The switch script is as follows

 Case$1 inchBlue)if[-F"Nginx.blue.conf.bak" ]         Then           MVnginx.conf Nginx.green.conf.bakMVNginx.blue.conf.bak nginx.conf Nginx-S Reload-p/weblogic/nginx-c conf/nginx.confEcho 'Switch to Blue'        Else           Echo 'configuration does not exist'        fi        ;; Green)if[-F"Nginx.green.conf.bak" ]         Then           MVnginx.conf Nginx.blue.conf.bakMVNginx.green.conf.bak nginx.conf Nginx-S Reload-p/weblogic/nginx-c conf/nginx.confEcho 'Switch to the Green Group'        Else           Echo 'configuration does not exist'        fi        ;;Esac

The Toggle command is

SH CBD. SH blue/green

Basic usage of Linux Nginx

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.