問題1 :nginx: [emerg] "server" directive is not allowed here in /usr/local/nginx/conf/nginx.conf:1
nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
解決方法:server 標籤需要在 http的標籤內
正確的配置寫法 : http {
server {}
}
問題2: nginx: [error] invalid PID number "" in "/usr/local/nginx/logs/nginx.pid"
解決方法:執行 /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
問題3:nginx: [emerg] no "events" section in configuration
解決方法:在nginx.conf 添加
events {
worker_connections 1024;
}