对,所以我有这个文件夹:/home/sites/dev/testphp/在这个文件夹里有一个index.php文件,有一个简单的回显行。我还有一个/home/sites/dev/testhtml/和一个index.html文件。
当我访问时http://testhtml.dev.ilun.no/它按预期工作。但当我访问时http://testphp.dev.ilun.no/我只是得到"没有指定输入文件。"
这是我到目前为止的配置:
server {
listen 80;
server_name dev.ilun.no www.dev.ilun.no;
root /home/sites/dev;
index index.php index.html;
}
server {
listen 80;
server_name ~^(.*)'.dev.ilun'.no$;
root /home/sites/dev/$1;
index index.php index.html;
if (!-d /home/sites/dev/$1) {
rewrite . http://dev.ilun.no/ redirect;
}
location ~ .php$ {
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}
我完全被这件事卡住了,还想不通。有什么建议吗?
动态根是一件棘手的事情,请尝试其他regexp:
server_name ~^(?P<subdomain>.+)'.dev.ilun'.no$;
root /home/sites/dev/$subdomain;