banner
约 300 字
1 分钟

Nginx 常用命令

无标签

启动nginx

Shell
nginx

关闭nginx

Shell
nginx -s stop

退出nginx

Shell
nginx -s quit

重启nginx

Shell
nginx -s reload

使用brew下载nginx

Shell
brew install nginx

查看目前执行的任务

Shell
brew services list

进入nginx 文件

Shell
cd /usr/local/etc/nginx

查看nginx的配置

Shell
vi nginx.conf

查看nginx配置有没有生效

Shell
nginx -t

nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok

nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful

启动nginx服务

Shell
brew services start nginx

重启nginx服务

Shell
brew services restart nginx

停止nginx服务

Shell
brew services stop nginx

查看是否启动

Shell
ps -ef|grep nginx

0 63206 1 0 5:21下午 ?? 0:00.00 nginx: master process nginx

-2 63274 63206 0 5:23下午 ?? 0:00.01 nginx: worker process

501 65848 62966 0 5:52下午 ttys001 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn nginx

停止当前master的服务

Shell
sudo kill -QUIT 63206

配置文件路径 /usr/local/etc/nginx/nginx.conf

END