Welcome! Log In Create A New Profile

Advanced

Re: try_files... don't think I'm doing it right.

March 20, 2009 05:16AM
<49C3530F.7000102@theactivitypeople.co.uk>

On Fri, Mar 20, 2009 at 08:25:51AM +0000, Phillip B Oldham wrote:

> Hey all.
>
> I'm trying to set-up an installation of zine, the python wordpress
> clone. I've set it to run as fast-cgi through a socket, but after a
> while it just flakes out. I'll get around to fixing that soon, but in
> the meantime I'd like nginx to fallback to showing a "maintenance" html
> page.
>
> Here's my config:
>
> server {
> listen 80;
> server_name mysite.com;
> error_page 500 502 503 504 /maintenance.html;
> location / {
> try_files @zine @fallback;
> }
> location @zine {
> include conf/fastcgi_params;
> fastcgi_param PATH_INFO $fastcgi_script_name;
> fastcgi_param SCRIPT_NAME "";
> fastcgi_pass unix:/tmp/mysite.socket;
> }
> location @fallback {
> root /var/www/mysite;
> index maintenance.html;
> }
> }
>
> This automatically falls-back, even though the instance is running.
>
> What am I doing wrong?

The try_files test files existance and fallback to last parameter.
As there is no @zine file it always goes to @fallback.
You config should be

server {
listen 80;
server_name mysite.com;

error_page 500 502 503 504 /maintenance.html;

location / {
include conf/fastcgi_params;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param SCRIPT_NAME "";
fastcgi_pass unix:/tmp/mysite.socket;

fastcgi_intercept_errors on;
}

location = /maintenance.html {
root /var/www/mysite;
}
}


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

try_files... don't think I'm doing it right.

Phillip B Oldham March 20, 2009 04:53AM

Re: try_files... don't think I'm doing it right.

Igor Sysoev March 20, 2009 05:16AM

Re: try_files... don't think I'm doing it right.

Phillip B Oldham March 20, 2009 05:30AM

Re: try_files... don't think I'm doing it right.

Igor Sysoev March 20, 2009 05:39AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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