On Wed, Mar 25, 2009 at 09:29:00PM -0700, Michael Shadle wrote:
> i changed a couple paths to mask the real stuff but this should give
> you an idea.
>
> This is some fastcgi stuff. I would think the intercept_errors one is
> what I want...?
>
> Is there an issue with the header being sent (in the middle of the debug log)
>
> fastcgi_ignore_client_abort on;
> fastcgi_intercept_errors on;
> fastcgi_buffers 32 8k;
> fastcgi_index index.php;
>
> here's the server block:
>
> server {
> listen 443;
> server_name foo.com;
> root /home/software/web/foo.com;
> index index.php index.html;
> ssl on;
> ssl_certificate mycert.pem;
> ssl_certificate_key mykey.key;
> ssl_protocols SSLv3 TLSv1;
> include /etc/nginx/expires.conf;
> location /files {
> rewrite ^/files/(.*) /foo.php?file=$1 last;
> }
> location / {
> if (!-e $request_filename) {
> rewrite ^(.*) /bar.php?slug=$1 last;
> }
> }
> location ~ \.php$ {
> fastcgi_pass 127.0.0.1:11021;
> }
> }
> }
Besides "fastcgi_intercept_errors on" you also need
error_page 404 /404.html;
nginx does not intercept an error if there is no custom handler for it:
it does not show its default pages. This allows to intercept some errors,
while passing others as are.
Also, two ways to omit rewrites:
location / {
try_files $uri /bar.php?slug=$uri;
}
location ~ ^/files/(.*) {
fastcgi_pass 127.0.0.1:11021;
fastcgi_param SCRIPT_FILENAME /foo.php;
fastcgi_param QUERY_STRING file=$1;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:11021;
fastcgi_param SCRIPT_FILENAME /path/to$uri;
fastcgi_param QUERY_STRING $query_string;
}
or
location / {
try_files $uri @bar;
}
location ~ ^/files/(.*) {
fastcgi_pass 127.0.0.1:11021;
fastcgi_param SCRIPT_FILENAME /path/to/foo.php;
fastcgi_param QUERY_STRING file=$1;
}
location @bar;
fastcgi_pass 127.0.0.1:11021;
fastcgi_param SCRIPT_FILENAME /path/to/bar.php;
fastcgi_param QUERY_STRING slug=$request_ur;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:11021;
fastcgi_param SCRIPT_FILENAME /path/to$uri;
fastcgi_param QUERY_STRING $query_string;
}
--
Igor Sysoev
http://sysoev.ru/en/