2014-12-02 62 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

相关问题