Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nginx error: "No input file specified" when website in subdirectory

Tags:

php

nginx

joomla

I have been trying to search about this problem a few hours but none of the solutions seem to work in my case.

I have installed joomla in my nginx server on raspbian for testing purposes. The directory is in /var/www/joomla.

The site works if I change the root directory from /etc/nginx/sites-available to /var/www/joomla, but if I want my joomla site accessed from http://www.example.com/joomla, it won't work. I can get to the joomla homepage, but if I click some link from the homepage (for example I have a contact form which address is http://www.example.com/joomla/index.php/contact) I get "No input file specified error".

Here is my config from /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;
     }
     }

I read this error may have something to do with fastcgi_param SCRIPT_FILENAME, but I didn't figure out what I should edit and from where.

Thank you!

like image 718
Erkki500 Avatar asked Dec 17 '25 05:12

Erkki500


1 Answers

Yes! I got it working. Thanks to Joe Niland who told the solution.

I actually tried it once but I may have missed the '/' before the joomla/index.php....

The working /etc/nginx/sites-available/site configuration is now:

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;
 }
 }
like image 193
Erkki500 Avatar answered Dec 19 '25 18:12

Erkki500



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!