2014-08-27 52 views
1

對,所以我有這個文件夾:/ home/sites/dev/testphp /這個文件夾裏面有一個index.php文件,帶有一個簡單的回顯行。我也有一個/ home/sites/dev/testhtml /和一個index.html文件。Nginx「沒有指定輸入文件」。在動態文件夾子域設置

當我訪問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; 
    } 
} 

我完全停留在這一點,並不能弄明白呢。有什麼建議麼?

回答

2

動態根是一件棘手的事情,嘗試其他的正則表達式:

server_name ~^(?P<subdomain>.+)\.dev.ilun\.no$; 
root /home/sites/dev/$subdomain; 
+0

*海量互聯網,擁抱你* – oles 2014-08-27 21:06:55

相關問題