我正在运行 nginx 版本:nginx/1.10.2
我想调整我的默认配置。根据https://www.nginx.com/blog/tuning-nginx/我更改了操作系统中的 somaxconn 参数,并在 nginx.conf 中指定了相同的参数
所以我的 nginx.conf 内容如下
listen 80 backlog=16384;
但是当我在 nginx.conf 中设置 backlog= 时,nginx 无法启动,并出现类似以下错误
Starting nginx: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
[FAILED]
删除 nginx 的 backlog 参数就可以了。如何在 nginx 中指定更高的 backlog
答案1
这可能是因为您已经有另一个带有listen
语句的虚拟主机。您必须将积压添加到所有listen
语句或将此语句绑定到特定 IP。