Nginx multiple php sites

wishmaster artemrts at ukr.net
Tue Jul 15 17:58:24 UTC 2014



 
 --- Original message ---
 From: "B.R." <reallfqq-nginx at yahoo.fr>
 Date: 15 July 2014, 19:16:19
  


> 
> 
> I also think CodeIgniter needs the PATH_INFO environment variable set.
 
   This is not true, as you can choose of using PATH_INFO, QUERY_STRING, REQUEST_URI and so on, so this tricks with path_info is excessive.
Just use try_files and fastcgi_split_path_info

> 
> 
> 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_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 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
_______________________________________________
nginx mailing list
nginx at nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx


> 
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
> 



More information about the nginx mailing list