启动nginx时报错,错误信息:linux
一、nginx: [emerg] unknown directive “server:192.168.111.171:8081” in /usr/local/nginx/conf/nginx.conf:37nginx
缘由:spa
这类错误,多数状况是由于conf写错,括号写错(花括号用了圆括号、圆括号配搭了花括号之类的),标点写错(逗号没逗对地方、分号没补上或者没写到正确的地方)。server
解决:程序
将“server:192.168.111.171:8081”中的冒号去掉,从新启动正常。端口
二、nginx: [emerg] bind() to 0.0.0.0:8081 failed (98: Address already in use) di
缘由:表示端口8081被其余程序所占用bind
解决:co
先linux命令:netstat -ntpl 查看端口使用directive
关闭kill占用的8081端口的PID