檢查配置文件是否正確:./nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
利用配置文件啓動nginx:
nginx -c /etc/nginx/nginx.conf
注意:
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
解決方案:
lsof -f:80
kill掉對應的http的pid
重新裝載配置文件:
nginx -s reload