我有一个包含破折号的域,例如the-domain.com,当我使用我的域的服务器名称创建服务器块并重新启动 nginx 时,我收到警告:
重新启动 nginx: nginx: [warn] server name "/var/www/domain.com/www/thedomain" 在 /etc/nginx/sites-enabled/domain.com:56 nginx 中有奇怪的符号。
所以我将域更改为我拥有的另一个域,它仍然继续从上面说同样的错误。我不明白为什么当我将其更改为合适的时会这样说?
这是重复的错误:
重新启动 nginx: nginx: [warn] server name "/var/www/domain.com/www/domaindir" 在 /etc/nginx/sites-enabled/domain.com:56 nginx 中有奇怪的符号。
我的域配置文件如下所示:
server {
server_name domain.com;
root /var/www/domain.com/www;
index index.php index.htm index.html;
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
access_log /var/www/domain.com/logs/access.log;
error_log /var/www/domain.com/logs/errors.log;
error_page 404 /index.php;
location ~ \.php$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/domain.com/www$fastcgi_script_name;
include fastcgi_params;
}
}
server {
server_name ~^(.+)\.domain\.com$;
set $file_path $1;
root /var/www/domain.com/www/$file_path;
index index.php index.htm index.html;
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
access_log /var/www/domain.com/logs/access.log;
error_log /var/www/domain.com/logs/errors.log;
location /
{
try_files $uri /$uri /index.php?$args;
}
location ~ \.php$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/domain.com/www$fastcgi_script_name;
include fastcgi_params;
}
}
server {
server_name anotherdomain.org
root /var/www/domain.com/www/domaindir; # this is line 56
index index.php index.htm index.html;
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
access_log /var/www/domain.com/logs/access.log;
error_log /var/www/domain.com/logs/errors.log;
location ~ \.php$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/domain.com/www$fastcgi_script_name;
include fastcgi_params;
}
}
Run Code Online (Sandbox Code Playgroud)
引发此错误的问题似乎是什么?