我正在尝试对我的网站进行重写,以便将 eosgaming.com 重写为 www.eosgaming.com。
这是我的 virtual.conf
#
# A virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
server {
listen 80;
server_name eosgaming.com;
rewrite ^/(.*) http://www.eosgaming.com/$1 permanent;
}
server {
listen 80;
server_name .eosgaming.com;
error_log /home/web/eosgaming.com/logs/error.log;
root /home/web/eosgaming.com/public_html/;
index index.html index.htm index.php;
location ~ \.php$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
server {
listen 80;
server_name .forum.eosgaming.com;
error_log /home/web/forums.eosgaming.com/logs/error.log;
root /home/web/forums.eosgaming.com/public_html/;
index index.html index.htm index.php;
location ~ \.php$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
server {
listen 80;
server_name .mysql.eosgaming.com;
error_log /home/web/mysql.eosgaming.com/logs/error.log;
root /usr/share/phpMyAdmin;
location / {
index index.php;
}
## Images and static content is treated different
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
access_log off;
expires 360d;
}
location ~ /\.ht {
deny all;
}
location ~ /(libraries|setup/frames|setup/libs) {
deny all;
return 404;
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/phpMyAdmin$fastcgi_script_name;
}
}
server {
listen 80;
server_name .source.eosgaming.com;
error_log /home/web/source.eosgaming.com/logs/error.log;
root /home/web/source.eosgaming.com/public_html/;
index index.html index.htm index.php;
location ~ \.php$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
这是我得到的错误
[root@vd1 ~]# service nginx restart
nginx: [warn] conflicting server name "eosgaming.com" on 0.0.0.0:80, ignored
Stopping nginx: [ OK ]
Starting nginx: nginx: [warn] conflicting server name "eosgaming.com" on 0.0.0.0:80, ignored
我该如何解决这个问题?我只想让我的网站添加 www。