question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

nginx reverse proxy not working

See original GitHub issue

I 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:closed
  • Created 3 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
nelson-ncommented, Jan 17, 2021

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.

0reactions
tverbekecommented, Jan 17, 2021

For the record it is ln -s [sic], but thanks for sharing the feedback and good that your issue is solved!

Read more comments on GitHub >

github_iconTop Results From Across the Web

NGINX Reverse Proxy Configuration and Troubleshooting
To solve this issue in nginx, need re-install nginx (you may need re-compile) with openssl library (Not LibreSSL provided by Mac OS). 504 ......
Read more >
proxy - nginx simple proxy_pass to localhost not working
I'm trying to run a minimalist reverse ...
Read more >
Nginx/proxy not working properly - Server Fault
1 Answer 1 ... You don't need quotes around the destination URL of proxy_pass . Main problem is the server_name ~.*.otherdomain.fr and the...
Read more >
NGINX Reverse Proxy
Configure NGINX as a reverse proxy for HTTP and other protocols, with support for modifying request headers and fine-tuned buffering of responses.
Read more >
Why is reverse proxy is not working with nginx? - DigitalOcean
I am trying to setup nginx reverse proxy on that application so that I can access it through port 80. At this point...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found