Server won't start AND Nginx as reverse proxy

Hi guys,

I have two issues on which I can not seem to find decent help:

1- See the configuration below. If the https://some.site.com site is
down,
Nginx won’t start. I still want Nginx to start whether this site is down
or
not:

server {
listen 8000;
location / {
proxy_pass https://some.site.com;
}
}

2- We have set up Nginx as a reverse proxy server to send users to a few
backend Swazoo web servers. If a particular Swazoo web server is
currently
busy handling a request, Nginx does not reverse proxy new incoming
requests
to one of the other Swazoo web servers and the site appears to be
‘hanging’.
Any help on this?

Thanks!

Posted at Nginx Forum:

Hi guys,

Concerning the first issue I had, I managed to get Nginx to now startup
when
I reboot the system, but the only way I could get it to work was by
adding a
sleep of a couple of seconds to the /etc/init.d/nginx startup script.

Is this acceptable practice?

Thanks,
Pieter

Posted at Nginx Forum:

On 24 Jan 2013 13h31 CET, [email protected] wrote:

Hi guys,

Concerning the first issue I had, I managed to get Nginx to now
startup when I reboot the system, but the only way I could get it to
work was by adding a sleep of a couple of seconds to the
/etc/init.d/nginx startup script.

Is this acceptable practice?

No.

Something is wrong with your setup.
— appa

2- Nginx does not reverse proxy new incoming requests to one of the other
Swazoo web servers and the site appears to be ‘hanging’. Any help on this?

The default proxy module timeouts are pretty high (like 60s)

http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_connect_timeout
http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_read_timeout

… so naturally if the backend doesnt respond in timely matter it can
take
up to a minute for nginx to decide what to do next.

I would also rather than using (with dns resolve):

location / {
proxy_pass https://some.site.com;
}

choose the upstream module (
Module ngx_http_upstream_module ) and define
all
the backends in the upstream {} block:

upstream someservers {
server your.backend1.ip:80;
server your.backend2.ip:80;
server your.backend2.ip:80;
}

location / {
proxy_pass http://someservers;
}

rr