我有一个域名,包括破折号,例如the-domain.com ,当我做了一个服务器块的服务器名称我的域名,并重新启动nginx,我得到一个警告:
重新启动nginx:nginx:[warn]服务器名称“/var/www/domain.com/www/thedomain”在/etc/nginx/sites-enabled/domain.com:56 nginx中有奇怪的符号。
所以我把域名换成了另外一个域名,它仍然继续从上面说出同样的错误。 我不明白为什么当我把它改为合适的时候这样说呢?
这个重复的错误:
重新启动nginx:nginx:[warn]服务器名称“/var/www/domain.com/www/domaindir”在/etc/nginx/sites-enabled/domain.com:56 nginx中有奇怪的符号。
我的域的configuration文件如下所示:
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; } }
什么似乎是造成这个错误的问题?
简单:缺less“;” 在第54行的server_name之后。
对我来说,这个错误的原因是在server_name中有“http://”。
即我改变了这一点:
server { listen <Server name>:80; server_name <DNS name> http://localhost:28080; ...
对此:
server { listen <Server name>:80; server_name <DNS name> localhost:28080; ...