nginx reverse proxy not working
See original GitHub issueI am attempting to deploy an app to the internet via nginx reverse proxy. My app is completely containerized and my nginx configuration file in /etc/nginx/sites-available matches the shinyproxy example here: https://www.shinyproxy.io/security/
server { listen 80; server_name shinyproxy.yourdomain.com; rewrite ^(.*) https://$server_name$1 permanent; }
server { listen 443; server_name shinyproxy.yourdomain.com; access_log /var/log/nginx/shinyproxy.access.log; error_log /var/log/nginx/shinyproxy.error.log error;
ssl on; ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_certificate /etc/ssl/certs/yourdomain.com.crt; ssl_certificate_key /etc/ssl/private/yourdomain.com.key;
location / { proxy_pass http://127.0.0.1:8080/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 600s;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
My domain has https certification and if I visit my domain I see the “Welcome to nginx!” screen. However, after I launch my app to listen on port 8080 with the command:
docker run -d -v /var/run/docker.sock:/var/run/docker.sock --net wind_net -p 8080:8080 wind_container
if I visit my domain I still see the “Welcome to nginx!” screen. Nginx is not passing my domain through to my shiny application. Any ideas on why the proxy reverse is not working? Have I launched my containerized shiny app to the wrong port?
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (2 by maintainers)
Top GitHub Comments
I have solved the issue. Nginx was not displaying the shinyproxy app because I had neglected to link my nginx configuration file in /etc/nginx/sites-available/ to /etc/nginx/sites-enabled. After linking my configuration in both directories with the
ls -s
command and removing the default configuration file from /etc/nginx/sites-enabled the shinyproxy app was displayed at my domain.For the record it is
ln -s
[sic], but thanks for sharing the feedback and good that your issue is solved!