在mac上安装了 brew 然后使用 brew install nginx 安装的 还有 brew install mysql
nginx 默认目录给放到了 /usr/local/sbin
启动nginx 的时候发现Address already in use
用lsof -i :8080 查看这个端口
ebProces 464 liu1695347_apple 25u IPv4 0xffffff801eb46a40 0t0 TCP localhost:53686->bt-199-037.bta.net.cn:http-alt (CLOSE_WAIT)
nginx 15508 root 6u IPv4 0xffffff800fd50a40 0t0 TCP *:http-alt (LISTEN)
nginx 15509 nobody 6u IPv4 0xffffff800fd50a40 0t0 TCP *:http-alt (LISTEN)
查出这样的东西
然后 kill -9 15508 kill -9 15509 就行了 然后再重新启动一下 OK
然后 http://127.0.0.1:8080 好了
修改配置文件后 启动 nginx 出现 invalid event type "epoll" in /usr/local/etc/nginx/nginx.conf:16
use epoll; 使用epool 仅用于linux2.6以上内核,可以大大提高nginx的性能 貌似mac用不了功能啊 先去掉吧
修改nginx 配置文件的时候 先 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 -s reload
kill pid文件的进程主id
启动服务的时候 setrlimit(RLIMIT_NOFILE, 65535) failed (22: Invalid argument)
一直有这个错误 然后修改worker_rlimit_nofile 这个参数linux 2.6内核下开启文件打开数为65535
关闭nginx ./nginx -s stop 或 kill -9 所有的进程(lsof -i :80端口)