Setting proxy_pass for Luigi in nginx

25 views
Skip to first unread message

Tashrif B.

unread,
Jul 17, 2020, 2:56:53 PM7/17/20
to Luigi
Hi there,

Luigi server is running on a remote server `my.org` at port 8082. http://my.org is publicly visible so I need to set up nginx `proxy_pass` at the remote server for being able to see the Luigi visualizer on the internet which is available at http://localhost:8082 locally.

For this purpose, I edited the last few lines-- `server{}` block of the default `/etc/nginx.conf`:

```
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    include /etc/nginx/conf.d/*.conf;

    server {
       location / {
           proxy_pass http://localhost:8082/static/visualiser/;
       }
    }

}
```


Then, when I plug in http://my.org/index.html on the internet, I get:

```html
<html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.16.1</center>
</body>
</html>
```


Can anyone please help with setting proxy_pass right?

Best,
Tashrif

Tashrif B.

unread,
Jul 17, 2020, 6:11:07 PM7/17/20
to Luigi
Hello again,

My problem went away magically. While I have not been able to figure the reason behind the error, I think the following may have fixed it:

       location / {
           proxy_pass http://localhost:8082;
       }  

```
nginx -s stop
service nginx restart
nginx -s reload
setsebool -P httpd_can_network_connect 1
```

Thanks,
Tashrif
Reply all
Reply to author
Forward
0 new messages