index or try_files in reverse proxy

meto nginx-forum at nginx.us
Wed Aug 12 23:27:47 MSD 2009


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)(.*)$ {

		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






More information about the nginx mailing list