After installing Mac nginx restart, stop, turn and other operations

Operating System: macOs High Sierra 10.13.6

1. I use homebrew installed nignx1.15.9, after the installation is complete there will be the following tips:

 

 

The web root directory: / usr / local / var / www

nginx configuration file locations: / usr / local / etc / nginx

Note: nginx is mounted to the directory location: / usr / local / Cellar / nginx

Default Port: 8080

2. Start:

Terminal run directly: nginx

 

Because I modified the configuration file: changed the default port 8080 80.

The reason is that need root privileges port below 1024 start, so sudo nginx can.

 

3. restart, stop

After viewing the help available:

 

Terminal run:

nginx -s reload sudo   // After modifying the configuration reloaded into force

Reopen nginx -s sudo    // reopen the log file

nginx -s STOP sudo   // quick stop nginx

nginx -s quit sudo   // stop complete and orderly nginx / elegant closed (open connection to the service completed)

 4. configuration file to determine whether there is a problem :

Terminal run: sudo nginx -t 

 

Other ways to stop nginx services:

View nginx processes, process, stop the process, then you can kill

View nginx processes: PS -ef | grep nginx

the kill -QUIT sudo // main process ID

sudo kill -TERM //主进程号

 

Guess you like

Origin www.cnblogs.com/pawn-i/p/11976772.html
Recommended