Welcome! Log In Create A New Profile

Advanced

php cgi + alias

Posted by bimbonius 
php cgi + alias
February 21, 2012 03:27PM
Hi.

I use alias to redirect a request:

location /foo {
alias /home/bar;
}

my config for php is:

location ~ \.php$ {
root /var/www;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /var/www$fastcgi_script_name;
}

So, if I browse to a php file in the root of the webserver (/var/www/file.php) everything works. But if I go to the "foo" directory (and nginx redirect to /home/bar) I get "No input file specified."

Nginx error log says nothing.
Re: php cgi + alias
February 22, 2012 10:54AM
Ok. Now i have one location ~ \.php$ for the whole location / and one for my alias location:


location / {
...
location ~ \.php$ {
...
}
}

location /foo/ {
alias /home/foo/bar/;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /home/foo/bar$fastcgi_script_name;
}
}

nginx uses the right one but i can't get it to pass the php file. Stil getting the "no input file" error.



Edited 1 time(s). Last edit at 02/22/2012 10:54AM by bimbonius.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 120
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready