Nginx可能的错误( – )在服务器名

以下是Nginx(v 1.2.1)的configuration

server { listen 80; server_name aaa.example.com; root /var/www/aaa; } server { listen 80; server_name hello-world.example.com; root /var/www/hello; } 

由于第二台服务器的服务器名称包含dash- ),因此nginx将始终打开第二台服务器(无论您是转到hello-world.example.com还是aaa.example.com)

我通过将hello-world重命名为helloworld来解决此问题(删除破折号修复了问题)。

这不是Nginx的错误吗?

这有点牵强,但是试试在nginx config的http上下文中join这一行:

 server_names_hash_bucket_size 64; 

然后重新启动nginx,看看是否有名字-工作。