php - nginx 错误 : "No input file specified" when website in subdirectory

标签 php joomla nginx

几个小时以来,我一直在尝试搜索这个问题,但似乎没有任何解决方案适用于我的情况。

出于测试目的,我已经在 raspbian 上的 nginx 服务器中安装了 joomla。 该目录位于/var/www/joomla。

如果我将根目录从/etc/nginx/sites-available 更改为/var/www/joomla,该站点将正常工作,但如果我希望从 http://www.example.com/joomla 访问我的 joomla 站点, 它不会起作用。 我可以访问 joomla 主页,但如果我单击主页上的某个链接(例如,我有一个地址为 http://www.example.com/joomla/index.php/contact 的联系表),我会收到“没有指定输入文件的错误”。

这是我在/etc/nginx/sites-available/site 中的配置:

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 有关,但我不知道我应该编辑什么以及从哪里编辑。

谢谢!

最佳答案

是的!我让它工作了。感谢告诉解决方案的 Joe Niland。

我实际上试过一次,但我可能错过了 joomla/index.php 之前的“/”....

工作的/etc/nginx/sites-available/site 配置现在是:

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;
 }
 }

关于php - nginx 错误 : "No input file specified" when website in subdirectory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27246326/

相关文章:

java - Spring mvc 应用程序与 php 论坛和 wiki 集成

php - MySQL,使用内部联接的更新查询静默失败

javascript - 奇怪的问题 div block 在 jquery 之后不会备份

node.js - 间歇性 502 错误网关错误(使用 nginx、nodejs、mongodb)

node.js - 如何使用 nginx 设置 SSL Node.js 应用服务器

linux - Docker Nginx工作进程以非root用户身份运行,但仍然可以访问root拥有的文件

php - 当用户从选择框中选择选项时更改输入字段的值

PHP MySQL : Take highest values from multiple categories and write an array?

joomla - Joomla的组件生成器?

php - 无法让图像堆叠在移动设备的居中文本上方居中