If you use try_files with fastcgi_split_path_info, do not try to set PATH_INFO with $fastcgi_path_info directly as it will be empty.
If PATH_INFO is not set (as it might not be required like you point it out) and stick with the $fastcgi_script_name of the split directive, then the PATH_INFO 2-lines trick is indeed useless but the rest is correct and recommended. --- *B. R.* On Tue, Jul 15, 2014 at 7:58 PM, wishmaster <[email protected]> wrote: > > > > --- Original message --- > From: "B.R." <[email protected]> > 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 > [email protected] > http://mailman.nginx.org/mailman/listinfo/nginx > > > > > > _______________________________________________ > > nginx mailing list > > [email protected] > > http://mailman.nginx.org/mailman/listinfo/nginx > > > > _______________________________________________ > nginx mailing list > [email protected] > http://mailman.nginx.org/mailman/listinfo/nginx >
_______________________________________________ nginx mailing list [email protected] http://mailman.nginx.org/mailman/listinfo/nginx
