2011-11-30 92 views
1

我在使用nginx和一些WordPress站点设置子域时遇到了麻烦。nginx上子域的wordpress站点

我的www.jackalopegames.com域正在工作,但我想设置dev.jackalopegames.com。

下面是我的启用站点文件夹中的配置文件:

server 
{ 
    listen 80; 
    server_name jackalopegames.com www.jackalopegames.com; 

    include /etc/nginx/fastcgi_php; 

    root /var/sitefolder; 

    index index.php; 

} 

server { 
    listen 80; 
    server_name dev.jackalopegames.com; 

    include /etc/nginx/fastcgi_php; 

    root /var/devfolder; 

    index index.php; 

} 

第一个server_name jackalopegames.com作品,但第二个没有。我已经看了一大堆,我对此感到不知所措。任何提示将不胜感激!

更新:

我已经添加了以下到我的子域server {...}有没有效果:

location/{ 
      root /var/dev; 
      index index.php; 
      rewrite ^.*/files/(.*)$ /wp-includes/ms-files.php?file=$1 last; 
      if (!-e $request_filename) { 
       rewrite ^.+/?(/wp-.*) $1 last; 
       rewrite ^.+/?(/.*\.php)$ $1 last; 
       rewrite ^(.+)$ /index.php?q=$1 last; 
      } 
     } 

     location ~* ^.+\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$ 
     { 
      root /var/dev; 
      rewrite ^/.*(/wp-.*/.*\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ $1 last; 
      rewrite ^.*/files/(.*(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$/wp-includes/ms-files.php?file=$1 last; 
      expires 30d; 
      break; 
     } 

     location ~ wp\-.*\.php|wp\-admin|\.php$ { 
      include /etc/nginx/fastcgi_params; 
      fastcgi_pass 127.0.0.1:9000; 
      fastcgi_index index.php; 
      fastcgi_param SCRIPT_FILENAME /var/dev$fastcgi_script_name; 
     } 
} 

回答