Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

i have a frontends server with nginx, this serve the static content, and forward by proxy_pass the rest.

I have a problem with the backends servers and this return 403 error randomy, this is in another question.

For a immediately solution, i want only pass if apache return 200, i now have:

/etc/nginx/conf.d/upstreams

upstream balanced {
        server 10.15.1.10:80;
        server 10.15.1.11:80;
        server 10.15.1.12:80;
}

And in the virtuals:

  server {
      access_log  /var/log/nginx/myweb.access.log main buffer=32k;
      error_log   /var/log/nginx/myweb.error.log info;
      #expires     31d;
      #limit_conn  gulag 5;
      listen      80; # rcvbuf=64k backlog=128;
      server_name myweb.com www.myweb.com;

        include /etc/nginx/proxy_params;


      location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
                access_log off;
                expires 30d;
                root    /srv/www/myweb/httpdocs;
      }

      location / {
        proxy_pass  http://balanced;
      }
 }

I need, in case of 403 response from the backs, try the next. as well as if the server does not respond.

Thanks, sorry my English

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You may want to check on proxy_next_upstream directive... http://wiki.nginx.org/HttpProxyModule#proxy_next_upstream

I don´t know if I can handle 403 requests on 1.0.x version, but seems easy to customize the code as shows this patch for 0.6.32 and 0.8.7 versions... http://forum.nginx.org/read.php?2,4830

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.