Welcome! Log In Create A New Profile

Advanced

Re: index or try_files in reverse proxy

August 13, 2009 03:22AM
On Wed, Aug 12, 2009 at 03:27:47PM -0400, meto wrote:

> I'm trying to set a reverse proxy for some time now and i'm out of ideas...
>
>
> index index.html index.htm index.php;
>
> location / {
> try_files $uri @proxy_backend;
>
> }
>
> location ~ ^(.+\.php)(.*)$ {

- location ~ ^(.+\.php)(.*)$ {
+ location ~ ^(.+\.php|/)$ {

If you want also to support PATH_INFO after PHP script, then you need
to split PATH_INFO:

location ~ ^(.+\.php.*|/)$ {
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
...

> error_page 404 /errors_pages/404.html;
>
> fastcgi_pass php;
>
> fastcgi_index index.php;
> fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
> fastcgi_intercept_errors on;
> fastcgi_buffers 100 32k;
> fastcgi_read_timeout 600;
>
> include fastcgi_params;
> }
>
> location @proxy_backend {
>
> proxy_pass http://IP:80;
>
> access_log off;
> expires off;
> }
>
>
> Almost everything is fine, but it's not passing domain.com/ to index.php via FastCGI, but goes to proxy :/ other php files are parsed by "php" upstream in nginx including domain.com/index.php (when included in URI).
>
> I also tried commenting index ... and using try_files $uri $uri/index.php, but then it provides index.php as text, ignoring fastcgi server. Am i doing something wrong, or is there a small bug?
>
> Posted at Nginx Forum: http://forum.nginx.org/read.php?2,4893,4893#msg-4893
>

--
Igor Sysoev
http://sysoev.ru/en/
Subject Author Posted

index or try_files in reverse proxy

meto August 12, 2009 03:27PM

Re: index or try_files in reverse proxy

meto August 12, 2009 07:47PM

Re: index or try_files in reverse proxy

edogawaconan August 13, 2009 12:40AM

Re: index or try_files in reverse proxy

Igor Sysoev August 13, 2009 03:22AM

Re: index or try_files in reverse proxy

meto August 13, 2009 06:15AM

Re: index or try_files in reverse proxy

Igor Sysoev August 13, 2009 06:24AM

Re: index or try_files in reverse proxy

meto August 13, 2009 10:13AM

Re: index or try_files in reverse proxy

Igor Sysoev August 13, 2009 02:13PM

Adding tests for handlers and filters

Marcus Clyne August 13, 2009 06:05PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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