Nginx 記錄

在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端口)   

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章