1

I've just taken over management of a server that a previous staff member set up. It's an Ubuntu 16.04.3 LTS server which is used purely as a SVN server for some legacy code (running on AWS).

It's running nginx and usually we can access in a browser the url https://mysvn.com and get a page that just states "It works!".

I recently patched the server with latest updates and after rebooting, I was getting a 502 Bad Gateway message in the browser. But the strange thing is, I created an attached new volumes using the most recent snapshots, and the problem still persists. So I guess this is not caused by the patching, but rather something about the nginx config that can't handle the reboot.

Unfortunately I don't know enough about nginx to see what's wrong with the config.

The error message in the logs is:

2018/01/08 09:35:05 [error] 10387#10387: *162 connect() failed (111: Connection refused) while connecting to upstream, client: XX.XX.XXX.XX, server: mysvn.com, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "mysvn.com"

The code from the file in /etc/nginx/sites-available is this:

server {
        listen 80 default_server;
        listen [::]:80 default_server;
        root /var/www/html;

        server_name mysvn.com;

        location /.well-known {
            alias /var/www/html/.well-known;
        }
}

server {
        listen              443 ssl;
        server_name         mysvn.com;
        ssl_certificate     /home/jenkins/.acme.sh/mysvn.com/mysvn.com.cer;
        ssl_certificate_key /home/jenkins/.acme.sh/mysvn.com/mysvn.com.key;
        ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers         "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
        ssl_dhparam         /etc/ssl/certs/dhparam.pem;

        root /var/www/html;

        # Add index.php to the list if you are using PHP
        index index.html index.htm index.nginx-debian.html;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                # try_files $uri $uri/ =404;
                proxy_pass http://localhost:8080/;
        }
        client_max_body_size 200M;

}

Is there any way to find more information about what is causing the error?

1 Answer 1

1

I'm not sure that this topic is for askubuntu.com, but will try to answer it.

You have proxy_pass http://localhost:8080/; which is something that nginx expects to work and proxy all the requests there. Maybe you have apache too and its not running after the servers reboot.

Try start it using : service apache2 start and see if you have "It works!" page!

3
  • Sometimes it's a bit unclear to me which site is the best for a particular question - apologies if I got this one wrong. In any case though, apache isn't installed on this server at all.
    – shaneoh
    Jan 8, 2018 at 11:24
  • So you look for which application uses port 8080. In your configuration Nginx waits for port 8080 to be opened, and if its not, it gives you "bad gateway". Hope this helps you Jan 8, 2018 at 11:43
  • I eventually discovered that apache was running inside a docker container and getting this container running was the issue.
    – shaneoh
    Jan 8, 2018 at 12:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .