0

I have set up Jetbrains Hub and Upsource on a machine using the ports 1111 and 1112 respectively.

These work, and if I access the machines using the local-network ip address of the machine they load.

I have then added (as per official docs) a reverse proxy for each of them to add an ssl layer on top of them using the given configuration:

server {
    listen 8080 ssl;

    ssl_certificate /path/to/pub.crt
    ssl_certificate_key /path/to/pub.key

    server_name  mydomainForThisMachine.com;

    location  / {
        proxy_set_header X-Forwarded-Host $http_host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_http_version 1.1;

        # to proxy WebSockets in nginx
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_pass http://127.0.0.1:1111/;
    }
}


server {
    listen 8081 ssl;

    ssl_certificate /path/to/pub.crt
    ssl_certificate_key /path/to/pub.key

    server_name  mydomainForThisMachine.com;

    location  / {
        proxy_set_header X-Forwarded-Host $http_host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_http_version 1.1;

        # to proxy WebSockets in nginx
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_pass http://127.0.0.1:1112/;
    }
}

This should, as i understand, forward port 8080 to port 1111 for Hub and 8081 to 1112 for Upsource

I have opened the ports using firewall-cmd and semanage.

However, when i try to access the https://mydomainForThisMachine.com:8080/ or :8081, The page loads using the certificates however I get a 502 Bad Gateway error. How can I even begin to solve this, is there something wrong with my configuration?

UPDATE After adding error logs to nginx i find this error when I try to connect:

2016/07/07 22:37:08 [crit] 26241#0: *1754 connect() to 127.0.0.1:1111 failed (13: Permission denied) while connecting to upstream, client: myPublicIp, server: mydomainForThisMachine.com, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:1111/favicon.ico", host: "mydomainForThisMachine.com:8080", referrer: "https://mydomainForThisMachine.com:8080/"

-1

I gave up on solving it effectively and disabled selinux. This worked.

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.