macos nginx install/uninstall, start/restart/shutdown

1. Installation/Uninstallation
Use homebrew to install brew install nginx in macos, and uninstall brew uninstall nginx.
homebrew install brew install xx, uninstall brew uninstall xx
can directly install nginx-full to install the echo module

brew install nginx-full

# If the above installation reports an error, you need to follow the steps below to install

brew tap denji/nginx-full

brew reinstall nginx-full --with-echo-module

2. Start
the current installation version is 1.21.5, the installation path is /usr/local/Cellar/nginx
configuration file path is /usr/local/etc/nginx/nginx.conf
server default path is /usr/local/var/www
Therefore, start:

cd /usr/local/Cellar/nginx/1.21.5/bin
nginx

3. Close ps -ef|grep nginx

The main process is 21024

# Quiet stop 
kill -QUIT 21024 
# Quick stop 
kill -TERM 21024 
# Forced stop 
kill -9 21024 
# Kill all nginx processes, sudo: Execute the command 
sudo killall nginx as a system administrator

4. Restart

nginx -s quit/stop/reload #Exit/stop/restart 
kill -HUP process number#Method two

5. Check the configuration file

// If it is a configuration file in the default location, it can be abbreviated as nginx -t 
nginx -t -c /usr/local/etc/nginx/nginx.conf

 

Guess you like

Origin blog.csdn.net/kongfanyu/article/details/128769487
Recommended