Nginx multiple php sites

B.R. reallfqq-nginx at
Tue Jul 15 16:15:22 UTC 2014

I also think CodeIgniter needs the PATH_INFO environment variable set.

Moreover, there is a potential security breach in your current 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)
<>, 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_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
    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 at> 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*
> _______________________________________________
> nginx mailing list
> nginx at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list