2012-12-15 4 views
1

eosgaming.com을 www.eosgaming.com으로 다시 작성하려면 내 웹 사이트를 다시 작성하려고합니다. 여기WWW 다시 작성 후 Nginx 다시 시작 경고 발생

내 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; 
    } 
} 

입니다 그리고 여기에 내가

[[email protected] ~]# 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를 추가하고달라고하고 싶다.

답변

0

.eosgaming.com;eosgaming.com *.eosgaming.com;과 동일하므로 server_name eosgaming.com;과 충돌합니다.

내가로 처음 두 서버의 지시를 결합하는 것이 좋습니다
1

같은 :

server { 
    listen  80; 
    server_name eosgaming.com; #removed the . because its not needed 

    if ($host ~* ^[^.]+\.[^.]+$) { #check if the host has no subdomain 
     rewrite ^(.*)$ http://www.$host$1 permanent; #Rewrite the url to include www. 
    } 

    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; 
    } 
}