nginx -s reload -p <nginx Environmental Directory > -c < Specified profile >

among -p -c Optional , Do not write as default path and configuration

Before executing a command, you can pass

nginx -t -p<> -c<>

Check that the custom configuration file is correct

in addition nginx The stop command is

ps -ef | grep nginx

kill -QUIT <pid>

30439 For example in the figure , by nginx master process Of pid

Start the command again

nginx -p<> -c<>

One of the pits is reload The command only supports changing the configuration file , Changing files is not supported , For example, the currently running configuration file in the figure above is nginx.conf, Then I modify this file and restart it. No problem

nginx -s reload -c conf/nginx.conf

But if I want to change to conf/nginx.other.conf

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

It doesn't work , He still reads the configuration of the original file again

So if there are multiple configuration files that need to be switched , My solution is to rename the configuration file , Change the name of the required configuration file to nginx.conf

mv nginx.other.conf nginx.conf

Actually, it's for switching between blue and green

The switch script is as follows

case $ in
if [ -f "" ]
mv nginx.conf
mv nginx.conf
nginx -s reload -p /weblogic/nginx -c conf/nginx.conf
echo ' Switch to blue '
echo ' Configuration does not exist '
if [ -f "" ]
mv nginx.conf
mv nginx.conf
nginx -s reload -p /weblogic/nginx -c conf/nginx.conf
echo ' Switch to the green group '
echo ' Configuration does not exist '

The switch command is

sh blue/green

linux nginx More articles on basic usage

  1. linux nginx The startup script

    linux nginx The startup script [root@webtest76 ~]# vi /etc/init.d/nginx #!/bin/bash # nginx Startup script for the ...

  2. ( turn ) linux And sort usage

    sort The command is to help us sort by different data types , Its syntax and common parameter format : sort [-bcfMnrtk][ Source file ][-o The output file ]  Additional explanation :sort Can be targeted at the content of the text file , Sort by behavior unit . ginseng Count ...

  3. Linux nginx Log splits instances by day

    Linux nginx Log splits instances by day   nginx There's a small drawback to my journal , The log file has always been a , It doesn't cut automatically , If there's a lot of traffic , Will cause the log file to be very large , It's not easy to manage, so we need to do it ourselves , Every... By date ...

  4. linux mail Command usage

    stay Linux Under the system mail Test of command 1. The simplest example : mail -s test The result of this command is a letter titled test To the back of the mailbox , If you have mta and ...

  5. linux+nginx+tomcat Load balancing , Realization session Sync

    linux+nginx+tomcat Load balancing , Realization session Sync Spent a morning studying nginx+tomcat Load balancing test for , The construction of cluster environment is relatively smooth , however session The problem of synchronization took hours ...

  6. MacOS + Linux + Nginx

    Asp.Net Core Release and deploy ( MacOS + Linux + Nginx ) Preface In the last article , It mainly introduces Dotnet Core Run command , This article is mainly about how to work in Linux in , Yes ...

  7. PHP Decompression of ZipArchive Medium extractTo() Method LINUX+nginx Decompression in the environment zip The problem of file loss when the system is running

    Use... In the project ZipArchive decompression ZIP file , At first, the test environment was WINDOWS In the platform , The test passed , Switch to LINUX+nginx When you are in the environment of There's a problem (ZIP There are files and directories in the package 3 More than 100 documents , Most of them are with Han ...

  8. linux expect, spawn Usage notes

    linux expect, spawn Usage notes _IT Migrant workers _ Baidu space linux expect, spawn Usage notes Copyright notice : When reprinting, please indicate the original source, author information and this statement in the form of hyperlink http://sys ...

  9. linux+nginx+mysql+php

    LNMP(linux+nginx+mysql+php) Server environment configuration   One . brief introduction Nginx It's very lightweight, written by Russians HTTP The server ,Nginx, Its pronunciation is “engine X”, Is a high-performance ...

Random recommendation

  1. mac Terminal show and hide hidden file command

    defaults write AppleShowAllFiles -bool true; killall Finder // Show hidden files defaults write ...

  2. How to write a simple http The server

    Use... In recent days C++ I wrote a simple one HTTP The server , As learning network programming and Linux Hands training project of environment programming , This article records that I am writing a HTTP Problems encountered in the process of server and knowledge learned . The source code of the server is placed in the Github. H ...

  3. What is? JVM?

    What is? JVM? JVM yes Java Virtual Machine(Java virtual machine ) Abbreviation ,JVM Is a specification for computing equipment , It's an imaginary computer , It is realized by simulating various computer functions on a real computer ...

  4. 111 Well known Java Project collection , Include url And description

    turn : Project name   Project description ASM Java bytecode manipulation framework A ...

  5. 3proxy Agent software documentation

    Official English original description : A brief description of the configuration file : If you understand English well , Try to study his handbook . Let's take an example nscache 65536 Domain name resolution ...

  6. Kali linux2.0 in Metasploit Of postgresql selected, no connection Problem solving

    Say what's in front of you 1. stay kali in metasploit By default postgresql As its database : Want to open metasploit The service has to be turned on first postgresql database , The order is as follows :( perhaps :/etc/in ...

  7. hadoop2.7 Directory structure of

    1.$HADOOP_HOME/bin Directory file and function File name explain hadoop Used to perform hadoop Script command , By Calls to perform , It can also be performed alone , The core of all orders 2.$HA ...

  8. margin and padding Four ways of writing

    We often see CSS Style property outer margin margin Internal margin padding Various uses of , Here is a summary , But just a brief introduction margin, Because their usage is similar . Method 1 . margin:10px; //4 A margin ...

  9. cocos2d-x Development record : Two , Basic concepts ( particle system ,Scheduler And timers )

    7、 ... and , particle system 1. introduction The term particle system refers to computer graphics technology , It uses a lot of very small sprites or other graphical objects to simulate certain kinds of “ Fuzzy ” The phenomenon , Compared with traditional rendering technology , It's hard to replicate . It's usually a highly chaotic system , Natural phenomena . chemical reaction ...

  10. 29_Future Pattern 2_JDK Built in implementation

    [Future Use scenarios ] Future The result of a possible unfinished task , For this result, you can add CallBack, In order to make the corresponding operation after the success or failure of the task . Future Pattern is very suitable for dealing with time-consuming business ...