2014-12-02 25 views
2

我一直在嘗試搜索這個問題幾個小時,但沒有一個解決方案似乎在我的情況下工作。nginx錯誤:「沒有指定輸入文件」當子目錄中的網站

爲了測試目的,我在raspbian的nginx服務器上安裝了joomla。 該目錄位於/ var/www/joomla中。

如果我將/ etc/nginx/sites-root可用的根目錄更改爲/ var/www/joomla,但是如果我想要從http://www.example.com/joomla訪問我的joomla站點,則該站點將無法工作。 我可以去joomla主頁,但是如果我點擊主頁上的一些鏈接(例如我有一個聯繫表格,地址是http://www.example.com/joomla/index.php/contact),我會得到「沒有輸入文件指定的錯誤」。

下面是從/ etc/nginx的/網站可用/網站我的配置:

server { 
    listen 80; 
    root /var/www; 
    index index.php index.html index.htm; 

    location/{ 
      try_files $uri $uri/ /index.php?q=$request_uri; 
    } 

    location ~ \.php$ { 
      fastcgi_pass unix:/var/run/php5-fpm.sock; 
      fastcgi_index index.php; 
      include fastcgi_params; 
    } 
    } 

我看了這個錯誤可能是與fastcgi_param SCRIPT_FILENAME,但我並沒有弄清楚什麼我應該編輯並從哪裏。

謝謝!

+0

當這個文件實際位於/joomla/index.php時,不是你向/index.php發送請求的問題嗎? – 2014-12-03 11:28:09

+0

謝謝Joe Niland!這是原因,現在它正在工作。 – Erkki500 2014-12-03 17:31:57

+0

不客氣! – 2014-12-04 03:44:07

回答

2

是的!我得到了它的工作。感謝解決方案的Joe Niland。

我真正嘗試過一次,但我可能已經錯過了現在「/」前的Joomla/index.php文件....

工作的/ etc/nginx的/網站可用/站點配置爲:

server { 
listen 80; 
root /var/www; 
index index.php index.html index.htm; 

location/{ 
     try_files $uri $uri/ /joomla/index.php?q=$request_uri; 
} 

location ~ \.php$ { 
     fastcgi_pass unix:/var/run/php5-fpm.sock; 
     fastcgi_index index.php; 
     include fastcgi_params; 
} 
} 
0

看看下面的配置設置

server { 
    listen 80; 
    root /var/www; 
    index index.php index.html index.htm; 

    location/{ 
      try_files $uri $uri/ /index.php?q=$request_uri$args; 
    } 

    location ~ \.php$ { 
      root /var/www; 
      fastcgi_pass unix:/var/run/php5-fpm.sock; 
      fastcgi_index index.php; 
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
      include fastcgi_params; 
    } 
    } 
+1

你可以添加一些更多的信息,爲什麼你認爲這個答案可能解決askers問題? – 2014-12-03 04:48:52

相關問題