Nginx Proxy 502 Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta nginx reverse proxy 502 bad gateway Discuss the workings and policies of this site About Us Learn more
Nginx Proxy_pass 502 Bad Gateway
about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Unix
502 Bad Gateway Nginx
& Linux Questions Tags Users Badges Unanswered Ask Question _ Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating
502 Bad Gateway Fix
systems. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Proxy (nginx) shows a Bad gateway error up vote 4 down vote favorite I have a service (docker registry) that runs on port 5000, I have 502 bad gateway php installed nginx to redirect http request from 8080 to 5000. If I make a curl to localhost:5000 it works, but when I make a curl to localhost:8080 I get a Bad gateway error. nginx config file: upstream docker-registry { server localhost:5000; } server { listen 8080; server_name registry.mydomain.com; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; client_max_body_size 0; chunked_transfer_encoding on; location / { proxy_pass http://docker-registry; } location /_ping { auth_basic off; proxy_pass http://docker-registry; } location /v1/_ping { auth_basic off; proxy_pass http://docker-registry; } } In /var/log/nginx/error.log I have: [crit] 15595#0: *1 connect() to [::1]:5000 failed (13: Permission denied) while connecting to upstream, client: 127.0.0.1, server: registry.mydomain.com, request: "GET / HTTP/1.1", upstream: "http://[::1]:5000/", host: "localhost:8080" Any idea? proxy nginx gateway share|improve this question edited Apr 17 '15 at 16:44 Badr Oyd 901113 asked Apr 17 '15 at 16:21 hellb0y77 2952925 add a comment| 2 Answers 2 active oldest votes up vote 11 down vote I assume its a Linux box, so most likely SELinux is preventing the connection as there is no policy allowing the connection. You should b
Zone Create a Push Zone Upload Data to a Push Zone Delete a Push Zone Push Zone Settings Push Zone Subusers Pull Zone Create a Pull Zone Delete a Pull Zone Purge CDN Cache Pull Zone Settings CNAMES Create 502 bad gateway nginx ubuntu a Zonealias Delete a Zonealias Zone Security How to setup Let's Encrypt TLS How 502 bad gateway nginx means to setup Custom SSL How to order a SSL certificate Secure Token Create a Zonereferrer (Hotlink Protection) Delete a Zonereferrer Debugging 502 bad gateway error CDN Troubleshooting Guide Technical Questions CDN Error Codes KeyCDN Log Format KeyCDN Log Forwarding Configure your own Syslog Server Getting Started General Account Management Integration Guides CMS Integration Guides Framework Integration Guides Custom CDN http://unix.stackexchange.com/questions/196907/proxy-nginx-shows-a-bad-gateway-error Integration CDN How To's Tutorials Zone Configuration General Settings Push Zone Create a Push Zone Upload Data to a Push Zone Delete a Push Zone Push Zone Settings Push Zone Subusers Pull Zone Create a Pull Zone Delete a Pull Zone Purge CDN Cache Pull Zone Settings CNAMES Create a Zonealias Delete a Zonealias Zone Security How to setup Let's Encrypt TLS How to setup Custom SSL How to https://www.keycdn.com/support/502-bad-gateway/ order a SSL certificate Secure Token Create a Zonereferrer (Hotlink Protection) Delete a Zonereferrer Debugging CDN Troubleshooting Guide Technical Questions CDN Error Codes KeyCDN Log Format KeyCDN Log Forwarding Configure your own Syslog Server Knowledge Base Support/Debugging How to solve 502 Bad Gateway Issues? Updated: July 20, 2016 Comments: 1 What does 502 Bad Gateway mean? A 502 Bad Gateway indicates that the edge server (server acting as a proxy) was not able to get a valid or any response from the origin server (also called upstream server). KeyCDN returns a 500 Origin Not Reachable if a 502 Bad Gateway occurred. What does 502 Bad Gateway mean? What are the reasons for 502 Bad Gateway responses? Domain name not resolvable: The domain name is not resolving to the correct IP or it does not resolve to any IP. It is important to note that DNS changes could take same time until they are global fully propagated and active. This is very dependant on the DNS TTL defined per record. Origin server down: The server is not reachable, either because it is down or there is no connectivity to the server given. Firewall blocks request: A firewall blocks the communication between the edge servers and the origin
Start here for a quick overview of the site Help Center Detailed answers to http://serverfault.com/questions/538316/bad-gateway-when-seting-up-nginx-as-a-reverse-proxy-server-for-gae any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more http://stackoverflow.com/questions/24785292/yet-another-502-error-with-nginx about hiring developers or posting ads with us Server Fault Questions Tags Users Badges Unanswered Ask Question _ Server Fault is a question and answer 502 bad site for system and network administrators. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Bad Gateway when seting up NGINX as a reverse proxy server for GAE up 502 bad gateway vote 2 down vote favorite I want to use NGINx as a reverse proxy server so I can open my GAE (google app engine) web site from china mainland, because there most of google IP's are blocked by the GFW. DNS: I have those DNS records:- A mydomain.com ==> x.x.x.x CNAME www ==> ghs.google.com CNAME * ==> ghs.google.com I'm planing to use geo DNS to point to my reverse proxy in case the request is coming from china mainland, currently I'm testing locally by having hosts record points mydomain.com to localhost. I have nginx 1.1.19 on ubuntu 12.04. my site configuration file is:- server { #listen 80; listen 443 ssl; server_name mydomain.com; ssl on; ssl_certificate /home/user/Desktop/ssl/mydomain.com.pem; ssl_certificate_key /home/user/Desktop/ssl/mydomain.com.key; ssl_session_timeout 5m; ssl_protocols SSLv3 TLSv1; ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP; ssl_prefer_server_ciphers on; large_client_header_buffers 4 16k; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; # keepalive_timeout 70; location / { proxy_pass https://mydomain.com/; proxy_set_header Host www.mydomain.com; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-HOST $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Yet another 502 error with nginx up vote 0 down vote favorite I'm trying to put a server@home in place with some basic services. All services run into a dedicated VM. Each VM is hosted on vSphere 5.5. So far I have : Debian wheezy with nginx used as a reverse proxy : 192.168.1.12 Debian wheezy with nodeJS used as a webapp server : 192.168.1.43 192.168.1.43:3000 => http web server that makes a redirection on 192.168.1.43:3001 192.168.1.43:3001 => https web server that makes provides the service Debian wheezy with madsonic installed : 192.168.1.35 As said in documentation I put --https-port=443 in the config to enable https access I use nginx to be able to have things like this : myapp.mydomaine.com => go to nodejs @ 192.168.1.43 music.mydomain.com => go to madsonic @ 192.168.1.35 I followed a tutorial and edited the "default" file in /etc/nginx/sites-enabled. Here is how it looks like : server { listen 80; server_name myapp.domaine.com; location / { proxy_pass http://192.168.1.43:3000; } } server { listen 443; server_name myapp.domain.com; ssl on; ssl_certificate [...]; ssl_certificate_key [...]; location / { proxy_pass https://192.168.1.43:3001; } } server { listen 80; server_name music.domain.com; location / { proxy_pass http://192.168.1.35:4040; } } server { listen 443; server_name music.domain.com; ssl on; ssl_certificate [...]; ssl_certificate_key [...]; location / { proxy_pass https://192.168.1.35; } } The first redirection on myapp works. The redirection on music works when I had only http on the madsonic server. When I activate https on madsonic server I get a 502 Bad gateway error (but the URL in Firefox is https://music.domain.com). I also tryed some other methods like mentionned here : How to redirect on the same port from http to https with nginx reverse proxy Did not work either. I also saw in /var/logs/nginx/error.log that the 502 error is due to a SSL_do_handshake error