Sta*_*erg 6 server-configuration nginx multiple-domains
使用Nginx,我为一个服务器创建了一个多域设置,该服务器由四个单独的站点组成.当我启动Nginx时,我收到一条错误消息,并且网站似乎混淆了,因为输入一个网址会导致其他网站之一.
显示错误消息 -
Restarting nginx: nginx: [warn] conflicting server name "localhost" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "localhost" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "localhost" on 0.0.0.0:80, ignored
nginx.
Run Code Online (Sandbox Code Playgroud)
我已经在/ sites-available下的各自文件中以类似的方式设置了所有四个域 -
server {
listen 80;
root /var/www/example.com/public_html;
index index.php index.html index.htm;
server_name example.com www.example.com;
location / {
try_files $uri $uri/ /index.html;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Run Code Online (Sandbox Code Playgroud)
我已经检查过,并且/ sites-enabled中没有默认文件.猜测Nginx主配置中可能存在错误设置但不确定要查找的内容.
您nginx.conf从include指令中的路径加载其外部服务器文件.
如果你有一个文件,include /etc/nginx/conf.d/*.conf;并且它的符号链接include /etc/nginx/sites-enabled将要加载文件两次,这将导致该错误.
| 归档时间: |
|
| 查看次数: |
23072 次 |
| 最近记录: |