我试图让子域名在访问时工作dev.domain.com
,它应该尾随到的根目录/var/www/domain.com/www/dev
。当我访问时,它会将我带到的根页面。/var/www/domain.com/www/
domain.com
dev.domain.com
domain.com
这是我的配置文件domain.com
:sites-enabled
server {
server_name *.domain.com 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;
# subdomain rewrites
if ($host !~* ^www\.domain\.com$) {}
if ($host ~* ^([^.]+)\.domain\.com$) {
set $auto_subdomain $1;
}
if (-d /var/www//www/$auto_subdomain) {}
if (-f /var/www//www/$auto_subdomain$uri) {
rewrite ^(.*)$ /$auto_subdomain$uri;
break;
}
# use fastcgi for all php files
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;
}
location /dev {
auth_basic "Development";
auth_basic_user_file /var/www/domain.com/www/dev/authfile;
}
}
我还需要它意识到它不应该在根目录中www.domain.com
寻找目录。www
/var/www/domain.com/www/