MacOS安装nginx,启动、重启、关闭

brew install nginx


Docroot is: /usr/local/var/www

The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that
nginx can run without sudo.

nginx will load all files in /usr/local/etc/nginx/servers/.

To have launchd start nginx now and restart at login:
brew services start nginx
Or, if you don't want/need a background service you can just run:
nginx


nginx配置文件目录:
/usr/local/etc/nginx/nginx.conf

启动nginx:
ngxin

重启nginx:
nginx -s reload

关闭/停止nginx:
先查询nginx对应端口号
ps -ef | grep nginx
501 53536 1 0 3:34下午 ?? 0:00.00 nginx: master process nginx
501 53569 53536 0 3:36下午 ?? 0:00.00 nginx: worker process
501 53611 52121 0 3:38下午 ttys000 0:00.00 grep nginx
kill nginx: master 端口号,即53536
kill -QUIT 53536

你可能感兴趣的:(MacOS安装nginx,启动、重启、关闭)