0

Am getting The connection has timed out after configuring a reverse proxy to some internal server.

Knowing that if i run wget i get 200 OK response and the correct page is downloaded.

[root@web1 nginx]# wget http://www.example.com:81
--2016-04-08 16:00:16--  http://www.example.com:81/
Resolving www.example.com (www.example.com)... ip-address
Connecting to www.example.com (www.example.com)|ip-address|:81... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1785 (1.7K) [text/html]
Saving to: قindex.htmlق

100%[=====================================================================================================================================================================>] 1,785       --.-K/s   in 0s

2016-04-08 16:00:16 (57.3 MB/s) - قindex.htmlق saved [1785/1785]

nginx.conf

http {
    server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  _;
        root         /usr/share/nginx/html;

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }

    server {
        server_name localhost;
        disable_symlinks if_not_owner;
        listen 80;
        include /etc/nginx/vhosts-includes/*.conf;
        location @fallback {
            error_log /dev/null crit;
            proxy_pass http://127.0.0.1:8080;
            proxy_redirect http://127.0.0.1:8080 /;
            proxy_set_header Host $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            access_log off ;
        }
    }
    include /etc/nginx/vhosts/*/*;
}

Under /etc/nginx/vhost/*/exmaple.conf

I have tried these two configurations:

server {
     server_name www.example.com;

     charset off;
     disable_symlinks if_not_owner from=$root_path;
     index index.php index.html;
     root $root_path;
     set $root_path /var/www/uexample/data/www/example.net;
     access_log /var/www/httpd-logs/example.com.access.log ;
     error_log /var/www/httpd-logs/example.com.error.log notice;
     include /etc/nginx/vhosts-includes/*.conf;


    location / {
        proxy_pass http://localhost:5601/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }

    ssi on;
    listen 81;
}


server {
    server_name www.example.com;
    location / {
        proxy_pass http://localhost:5601/;
    }
    listen 81;
}
  • What is your nginx configuration? – Tero Kilkanen Apr 8 '16 at 13:06
  • Can you please post the configuration from /etc/nginx/sites-enabled/default ? – Alin Andrei Apr 8 '16 at 13:10
  • @AlinAndrei i dont have such directory neither sites-available – Fadi Assaad Apr 8 '16 at 13:24
  • @FadiAssaad ok, what about /etc/nginx/sites-available ? – Alin Andrei Apr 8 '16 at 13:26
  • As previously said i don't have such directories. I have different setup on my system. there is nginx.conf file that include vhosts conf files. – Fadi Assaad Apr 8 '16 at 13:28
0

As using port other than 80 is not possible (unknown reason) the workaround involved using a subdomain & listening to ip-address:port.

server {
    server_name subdomain.domain.com;
    listen IP-Address:80;

    location / {
        proxy_pass http://localhost:5601/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
    ssi on;
}
  • good work man :) – Alin Andrei Apr 11 '16 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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