Question

I get this error when I try to use nginx as a reverce proxy server for apache. I guess I have something wrong with nginx side of configuration because when I access the web-host with port I use for apache, everything works nice. So, here is my nginx configuration file for host:

server{
    listen 80;
    server_name my-site;

    root /usr/share/nginx/www;
        index index.html index.htm;

    location /static {
        alias /var/www/my-site/myapp/static;
    }

    location /media {
        alias /var/www/my-site/myapp/media;
    }

    location / {
        proxy_pass http://my-site:8000;
    }
}

Here's my error log for nginx, it wasn't any useful for me though:

2014/02/22 13:58:37 [error] 1398#0: *10 upstream timed out (110: Connection timed out) while connecting to upstream, client: XXX.XXX.XXX.XXX, server: my-site, request: "GET / HTTP/1.1", upstream: "http://XXX.XXX.XXX.XXX:8000/", host: "my-site"
2014/02/22 14:01:40 [error] 1398#0: *14 upstream timed out (110: Connection timed out) while connecting to upstream, client: XXX.XXX.XXX.XXX, server: my-site, request: "GET / HTTP/1.1", upstream: "http://XXX.XXX.XXX.XXX:8000/", host: "my-site"
2014/02/22 14:10:29 [error] 1609#0: *1 upstream timed out (110: Connection timed out) while connecting to upstream, client: XXX.XXX.XXX.XXX, server: my-site, request: "GET / HTTP/1.1", upstream: "http://XXX.XXX.XXX.XXX:8000/", host: "my-site"
2014/02/22 19:07:59 [error] 647#0: *176 upstream timed out (110: Connection timed out) while connecting to upstream, client: XXX.XXX.XXX.XXX, server: my-site, request: "GET / HTTP/1.1", upstream: "http://XXX.XXX.XXX.XXX:8000/", host: "my-site"
2014/02/23 13:40:35 [error] 647#0: *650 upstream timed out (110: Connection timed out) while connecting to upstream, client: XXX.XXX.XXX.XXX, server: my-site, request: "GET / HTTP/1.1", upstream: "http://XXX.XXX.XXX.XXX:8000/", host: "my-site"

I've read somewhere that it may happen when load is too big, but in my case this is definitely not it.

Was it helpful?

Solution

Is your Apache bound to port 8000?

Have you made sure that you can access port 8000 with the external IP address associated to your domain? You can do this by retrieving a page with the http://my-site:8000 URL on the server.

You could try using

proxy_pass 127.0.0.1:8000;

instead of my-site:8000;

This way you don't need the ability to connect to your site via your external IP.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top