通过brew安装nginx
brew search nginx
brew install nginx
通过brew安装nginx后的路径
1. /usr/local/etc/nginx/nginx.conf (配置文件路径)
2. /usr/local/var/www (服务器默认路径)
3. /usr/local/Cellar/nginx/1.8.0 (安装路径)
加载某个配置文件
(假如加载nginx.conf,配置文件一定要加路径,否则默认会在nginx安装路径所在目录下去找配置文件。)
nginx -c /usr/local/etc/nginx/nginx.conf
查看被占用的端口(假如查看8080端口)
lsof -i:8080
得到的结果是
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 14306 9u IPv4 0x38adf66b334c781f 0t0 TCP *:cslistener (LISTEN)
nginx 14633 9u IPv4 0x38adf66b334c781f 0t0 TCP *:cslistener (LISTEN)
杀死某个进程
kill 14306
网友评论