我使用已安装的 DirectAdmin 和 Nginx,我目前拥有大量客户端,有时我会看到“Nginx 503 错误”,并且我有 3Gb 内存,其中已使用 790 个内存...
现在我想增加 Worker Connections,但是在这个文件中我没有此项:
nano /etc/nginx/nginx.conf
当我手动添加此项时,Nginx 重启后出现以下错误:
[root@server ~]# service nginx restart
nginx: [emerg] "worker_connections" directive is duplicate in /etc/nginx/nginx-events.conf:1
nginx: configuration file /etc/nginx/nginx.conf test failed
另外,当我将“worker_processes 1;”增加到 5 时,重新启动 nginx 后它仍然看到 1 并显示以下输出:
[root@server ~]# grep processor /proc/cpuinfo | wc -l
1
以下是我的配置文件的输出:
#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 100;
pid /var/run/nginx.pid;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
events {
# worker_connections 1024;
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/directadmin-ips.conf;
include /etc/nginx/directadmin-settings.conf;
include /etc/nginx/nginx-vhosts.conf;
include /etc/nginx/directadmin-vhosts.conf;
}
答案1
/proc/cpuinfo
显示有关系统处理器的信息。它与 nginx 工作进程无关。您的问题很可能是由于您的应用服务器无法处理访问者造成的负载而引起的。
看了你提供的信息,如果我是你,我会聘请专业的系统管理员来分析这个问题。不幸的是,你似乎缺乏很多基本知识,自己分析问题会花很长时间。指导你进行分析不适合这样的问答网站。
此外,您正在使用控制面板软件,而有关这些问题在这里与主题无关。