乐趣区

MacHomebrew查找nginx安装目录和nginxconf配置文件目录

1. nginx 装置目录

$ ps -ef | grep nginx

装置目录就在:/usr/local/opt/nginx/bin/nginx,如下

zhangguoyedeMacBook-Pro:nginx zhangguoye$ ps -ef | grep nginx
  501  1543     1   0  9 919  ??         0:00.04 nginx: master process /usr/local/opt/nginx/bin/nginx -g daemon off;
  501  1700  1543   0  9 919  ??         0:00.00 nginx: worker process
  501 37720   929   0 11:37 上午 ttys006    0:00.00 grep nginx

2.nginx.conf 配置文件目录

$ nginx -t

配置文件目录就在:/usr/local/etc/nginx/,如下

zhangguoyedeMacBook-Pro:nginx zhangguoye$ 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

3. 启动 / 暂停 / 重载

# 启动
$ sudo brew services start nginx

# 暂停
$ nginx -s stop

# 重载
$ nginx -s reload
退出移动版