我正在使用 nginx,尝试在端口 80(或 root)上加载站点在尝试连接一段时间后会出现 502 bad gateway 错误。
当我输入时:netstat -ltnp | grep :80
我得到以下结果。
这是我的 nginx.conf:
#user nginx;
# The number of worker processes is changed automatically by CustomBuild, according to the number of CPU cores, if it's set to "1"
worker_processes 4;
pid /var/run/nginx.pid;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
events {
include /etc/nginx/nginx-events.conf;
}
http {
include /etc/nginx/mime.types;
# For user configurations not maintained by DirectAdmin. Empty by default.
include /etc/nginx/nginx-includes.conf;
# Supplemental configuration
#include /etc/nginx/nginx-modsecurity-enable.conf;
include /etc/nginx/nginx-defaults.conf;
include /etc/nginx/nginx-gzip.conf;
include /etc/nginx/nginx-proxy.conf;
include /etc/nginx/directadmin-ips.conf;
include /etc/nginx/directadmin-settings.conf;
include /etc/nginx/nginx-vhosts.conf;
include /etc/nginx/directadmin-vhosts.conf;
server {
listen 80;
root /var/www/html;
index index.html index.htm index.php;
}
}
注意:除 80 以外的任何其他端口都可以正常工作。显然 8080 和 8081 被占用,但除此之外,任何其他端口(例如 8000)都可以正常工作。
这可能是什么原因造成的?