<div dir="ltr"><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(36,39,41);font-family:arial,"helvetica neue",helvetica,sans-serif">Trying to do a simple proxy from <code style="margin:0px;padding:1px 5px;border:0px;font-size:13px;font-family:consolas,menlo,monaco,"lucida console","liberation mono","dejavu sans mono","bitstream vera sans mono","courier new",monospace,sans-serif;background-color:rgb(239,240,241);white-space:pre-wrap"><a href="http://sub.domain.com/link1" target="_blank">sub.domain.com/link1</a></code> to another server on the LAN -  <code style="margin:0px;padding:1px 5px;border:0px;font-size:13px;font-family:consolas,menlo,monaco,"lucida console","liberation mono","dejavu sans mono","bitstream vera sans mono","courier new",monospace,sans-serif;background-color:rgb(239,240,241);white-space:pre-wrap"><a href="http://10.1.1.1:8080/someotherlink1" target="_blank">10.1.1.1:8080/<wbr>someotherlink1</a></code>.</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(36,39,41);font-family:arial,"helvetica neue",helvetica,sans-serif">This is what my server context looks like: (I modified the default nginx.conf)</p><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:1em;padding:5px;border:0px;font-size:13px;width:auto;max-height:600px;overflow:auto;font-family:consolas,menlo,monaco,"lucida console","liberation mono","dejavu sans mono","bitstream vera sans mono","courier new",monospace,sans-serif;background-color:rgb(239,240,241);word-wrap:normal;color:rgb(36,39,41)"><code style="margin:0px;padding:0px;border:0px;font-family:consolas,menlo,monaco,"lucida console","liberation mono","dejavu sans mono","bitstream vera sans mono","courier new",monospace,sans-serif;white-space:inherit">server {
    listen       80 default_server;
    listen       [::]:80 default_server;
    server_name  <a href="http://sub.domain.com/" target="_blank">sub.domain.com</a>;
    root         /;

    # Load configuration files for the default server block.
    include /etc/nginx/default.d/*.conf;

    location /link1 {      
        proxy_pass <a href="http://10.1.1.1:8080/link2" target="_blank">http://10.1.1.1:8080/link2</a>
    }
}
</code></pre><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(36,39,41);font-family:arial,"helvetica neue",helvetica,sans-serif">`</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(36,39,41);font-family:arial,"helvetica neue",helvetica,sans-serif">but visiting a webpage is just loading the nginx 502 bad gateway page.</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(36,39,41);font-family:arial,"helvetica neue",helvetica,sans-serif">Error in the log is:</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(36,39,41);font-family:arial,"helvetica neue",helvetica,sans-serif"><code style="margin:0px;padding:1px 5px;border:0px;font-size:13px;font-family:consolas,menlo,monaco,"lucida console","liberation mono","dejavu sans mono","bitstream vera sans mono","courier new",monospace,sans-serif;background-color:rgb(239,240,241);white-space:pre-wrap">2017/03/15 22:04:27 [crit] 8647#0: *11 connect() to <a href="http://10.1.1.1:8080/" target="_blank">10.1.1.1:8080</a> failed (13: Permission denied) while connecting to upstream, client: 112.xxx.xxx.xxx, server: <a href="http://sub.domain.com/" target="_blank">sub.domain.com</a>, request: "GET /link1/ HTTP/1.1", upstream: "<a href="http://10.1.1.1.1:8080/link2/" target="_blank">http://10.1.1.1.1:8080/link2/</a><wbr>", host: "<a href="http://sub.domain.com/" target="_blank">sub.domain.com</a>"</code></p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(36,39,41);font-family:arial,"helvetica neue",helvetica,sans-serif">whats a bit strange looking is the <code style="margin:0px;padding:1px 5px;border:0px;font-size:13px;font-family:consolas,menlo,monaco,"lucida console","liberation mono","dejavu sans mono","bitstream vera sans mono","courier new",monospace,sans-serif;background-color:rgb(239,240,241);white-space:pre-wrap">GET /link1/</code> - as this this should not be the link in the final upstream URL - it should not be trying to get this link.</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(36,39,41);font-family:arial,"helvetica neue",helvetica,sans-serif">What am I doing wrong?</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(36,39,41);font-family:arial,"helvetica neue",helvetica,sans-serif">Thanks,</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(36,39,41);font-family:arial,"helvetica neue",helvetica,sans-serif">Jason</p></div>