Welcome! Log In Create A New Profile

Advanced

Re: Nginx multiple php sites

B.R.
July 15, 2014 12:18PM
I also think CodeIgniter needs the PATH_INFO environment variable set.

Moreover, there is a potential security breach in your current configuration
https://nealpoole.com/blog/2011/04/setting-up-php-fastcgi-and-nginx-dont-trust-the-tutorials-check-your-configuration/
..
The recommended way (when using the same machine for front-end and back-end
services) it to use try_files to check for the existence of the invoked PHP
script. However, since using try_files with fastcgi_split_pathinfo wreaks
havoc (that *won't fix*, not a bug... oO)
http://trac.nginx.org/nginx/ticket/321, I would recommend patching you
PHP location like the following:

location ~^ \.php$ {
# root /var/www/example/; # You should follow Anoop piece of advice
index index.php;
fastcgi_pass 127.0.0.1:9000;

fastcgi_split_path_info ^(.+\.php)(/.*?)$;
# $fastcgi_script_name is a system path to a file,
# while $uri is... an URI which might not always correspond to a file
try_files $fastcgi_script_name =404; # Checking PHP script existence

# A trick to go beyond the bug/'feature' using try_files with
fastcgi_split_pathinfo
set $path_info $fastcgi_path_info
fastcgi_param PATH_INFO $path_info;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}


Hope I helped,
---
*B. R.*


On Tue, Jul 15, 2014 at 4:31 PM, Anoop Alias <anoopalias01@gmail.com> wrote:

> Perhaps this didnt work for you because you have
>
> root /var/www/example/;
>
> in the php location . Move up the root in location / to the server {}
> level and delete the root from php location . This is also the best
> approach as per nginX docs
>
>
>
> --
> *Anoop P Alias*
> GNUSYS http://gnusys.net
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Nginx multiple php sites

devsathish July 15, 2014 09:15AM

Re: Nginx multiple php sites

Anoop Alias July 15, 2014 10:30AM

Re: Nginx multiple php sites

Anoop Alias July 15, 2014 10:32AM

Re: Nginx multiple php sites

B.R. July 15, 2014 12:18PM

Re[2]: Nginx multiple php sites

artem July 15, 2014 02:00PM

Re: Re[2]: Nginx multiple php sites

B.R. July 15, 2014 03:44PM

Re: Nginx multiple php sites

Francis Daly July 18, 2014 10:40AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 170
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