Questions tagged [502-error]

HTTP Error 502 Bad gateway

Filter by
Sorted by
Tagged with
142 votes
8 answers
713k views

connect() failed (111: Connection refused) while connecting to upstream

I'm experiencing 502 Gateway errors when accessing a PHP file in a directory (http://example.com/dev/index.php). The logs simply says this: 2011/09/30 23:47:54 [error] 31160#0: *35 connect() failed (...
MacMac's user avatar
  • 2,091
10 votes
4 answers
10k views

What's the difference between example.com and www.example.com?

I'm a developer and I'm having trouble setting up some hosting, and I hope you guys can help me out. I've got a domain I'm setting up for a friend. URLs work fine when I use the short form, like ...
Steve Cooper's user avatar
8 votes
1 answer
23k views

Resource temporarily unavailable while connecting to upstream (php5-fpm)

I frequently get this error on random pages when the are like ~+10K connections (netstat -an |grep 80 |wc -l). This happens while there is still +10GB of free memory and server load is less than 3. ...
alfish's user avatar
  • 3,137
7 votes
4 answers
42k views

Nginx error stating connection refused to PHP-FPM port

Newly create LEMP stack running PHP-FPM on Ubuntu 14.04 x64. Attempting to access some PHP in my webroot. Browser is showing 502 Bad Gateway and Nginx error log is showing the following (my IP and ...
sparecycle's user avatar
7 votes
2 answers
9k views

Nginx + PHP-FPM = "Random" 502 Bad Gateway

I am running Nginx and proxying php requests via FastCGI to PHP-FPM for processing. I will randomly receive 502 Bad Gateway error pages - I can reproduce this issue by clicking around my PHP websites ...
user avatar
5 votes
2 answers
19k views

How to add a fallback to my proxy in nginx?

I am trying to build a proxy for my node application through nginx thinking this will give me error pages if the node application failed or is not available on the port. The node app runs on 127.0.0....
Dominik's user avatar
  • 315
4 votes
1 answer
15k views

Difference between keepalive in apache2.conf and in ProxyPass

I am using Apache 2.2.22 What is the difference, if there is any, between the Keepalive directive in /etc/apache2/apache2.conf # # KeepAlive: Whether or not to allow persistent connections (more ...
nwtnsqrd's user avatar
4 votes
2 answers
7k views

PHP/FPM/Nginx Issue: Runs fine for a hours, then maxes FPM children in a matter of seconds, resulting in 502 errors

We recently migrated a long running (without issue) Ubuntu 16.04 / nginx (1.10.3) / PHP 7.0 stack over to an Ubuntu 18.04 / nginx (1.14.0) / PHP 7.2 stack. The result has caused instability at the PHP-...
Slickrick12's user avatar
4 votes
2 answers
386 views

Upgrade 2 Ghost blogs on same server, 1 quits immediately when run as a service

I have 2 Ghost blogs on a Digital Ocean server running: Ubuntu 14.04.3 LTS Nginx 1.4.6 (Ubuntu) Node v0.12.7 I used the instructions provided by Digital Ocean to set up the blogs, and they have ...
John Stephens's user avatar
4 votes
3 answers
12k views

nginx 502 bad gateway - fastcgi not listening? (Debian 5)

I have experience with nginx but it's always been pre-installed for me (via VPS.net pre-configured image). I really like what it does for me, and now I'm trying to install it on my own server with apt-...
Sean's user avatar
  • 379
4 votes
0 answers
4k views

NGINX 502 Bad Gateway error inside Docker container

I haven't had any issues with my Docker container or NGINX until today where I am getting a random unexpected 502 Bad Gateway error even though I have made no changes to my configuration files, Docker ...
CrashV24232's user avatar
3 votes
1 answer
12k views

Nexus returns error 502 (Bad Gateway) when publishing artifacts

I've just completed the installation of Sonatype Nexus 3.2.1-01 and I'm trying to publish some artifacts using a Jenkins job and the Nexus Artifact Uploader 2.9 plugin. The upload starts fine: 100 % ...
Tedi's user avatar
  • 161
3 votes
2 answers
5k views

Finding Nginx/PHP-FPM bottleneck that is causing random 502 gateway errors

I work for a rather busy internet site that is often gets very large spikes of traffic. During these spikes hundreds of pages per second are requested and this produces random 502 gateway errors. Now ...
Mr.Boon's user avatar
  • 1,471
3 votes
1 answer
252 views

Apache Local virtualhosts not working (502 error) [closed]

My local dev environment consists of a mac with OSX El Capitan 10.11.6. I have Apache 2.4.28 installed. Something seems to have gone wrong with my virtual host configuration as none of my local ...
Mr B's user avatar
  • 151
3 votes
1 answer
1k views

After upgrade from ubuntu 14.04 to 16.04, nginx error 502: bad gateway until nginx is restarted

I have researched this problem, but in most cases the cause of the 502 error is an improperly configured nginx.conf or upstream service. I believe this is different.. As the title suggests, I ...
chrismeu's user avatar
  • 133
3 votes
5 answers
13k views

Nginx 502 Bad Gateway when uploading files

I get the following error when I try to upload files to my node.js based web app: 2014/05/20 04:30:20 [error] 31070#0: *5 upstream prematurely closed connection while reading response header from ...
bob_cobb's user avatar
3 votes
1 answer
2k views

qmail responds 502 unimplemented on STARTTLS

I am trying to send mail with php using the PEAR Mail_queue package. It should be working, and it appeared to work twice, but for some reason I keep getting the following error response from qmail: ...
Syntax Error's user avatar
3 votes
1 answer
7k views

(111: Connection refused) while connecting to upstream - Opsworks Rails 4

I deployed a rails 4 application in OpsWorks (Ubuntu 14.04, nginx and unicorn), when I open the homepage I'm getting a 502 Bad Gateway error. In nginx/error.log I can see this error: 2015/01/25 06:19:...
darkcode's user avatar
  • 131
3 votes
1 answer
1k views

Sporatic 502 errors with Ruby on Rails site running on Nginx

My Ruby on Rails site is throwing sporadic 502 errors. It is running on Nginx, installed with Passenger, and is hosted on a server running Ubuntu 10.04. It seems that the errors are becoming more and ...
Colby Aley's user avatar
3 votes
1 answer
9k views

How to configure nginx.conf and php-fpm using brew servinces in MAC-OS in order to run php?

I have following logs in php-fpm log . [19-Jan-2020 15:09:33] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root [19-Jan-2020 15:09:33] NOTICE: [pool www] 'user' directive ...
Shashank Gupta's user avatar
3 votes
0 answers
3k views

Docker: Nginx and hhvm socket configuration returns 502 Bad Gateway

I am trying to run nginx and hhvm with docker-compose and socket file configuration but it returns a 502 error. I can access to conf/hhvm/run/ from nginx and hhvm image. In the error.log nginx's file ...
Avel's user avatar
  • 31
2 votes
1 answer
22k views

Nginx reverse proxying to upstream getting 502 Bad Gateway?

My current Application deployment is receiving traffic on HTTP port and Nginx redirect it to HTTPS. This is working fine. Now we are planning to have another Nginx server act like a Load balancer to ...
PrashantB's user avatar
  • 133
2 votes
2 answers
644 views

Where do these "single-dot" smtp connection failures come from?

I'm running a mailserver based on postfix. There are a lot of connection failures like this: Transcript of session follows. Out: 220 hostname.tld ESMTP Postfix In: . Out: 502 5.5.2 Error: command ...
McJoey's user avatar
  • 121
2 votes
2 answers
14k views

Nginx: 502 Bad GateWay

I try install nginx. I used to lighttpd but now we must install nginx. Can you help me with configuration nginx? I use debian 6. My nginx.conf: user www-data; worker_processes 4; pid /var/run/nginx....
Bartosz Kowalczyk's user avatar
2 votes
1 answer
2k views

Angular server side rendering keeps going down to 502 errors

So I have been running my front end on the server for a few weeks now(angular Server Side rendering). I keep running into this issue where the front end goes down to a 502 error. I have to restart the ...
Venomoustoad's user avatar
2 votes
1 answer
20k views

502 "Error reading from remote server" when upstream service errors

I have apache set up as a reverse proxy. When the upstream service has an error (e.g. 500) the error is not returned to the client, but instead apache serves up a 502 "Error reading from remote server"...
DJL's user avatar
  • 155
2 votes
1 answer
8k views

Nginx + PHP-FPM on Centos 6.5 gives me 502 Bad Gateway (fpm error: unable to read what child say: Bad file descriptor)

I am setting up a standard LEMP stack. My current setup is giving me the following error: 502 Bad Gateway This is what is currently installed on my server: Here's the configurations I've created/...
Latheesan's user avatar
  • 357
2 votes
1 answer
28k views

Apache VirtualHost setup… 502 Bad Gateway

I am trying to set up apache virtual hosts on Ubuntu 12.04 lts. I followed this guide here http://www.debian-administration.org/articles/412 except I used /var/www not /home/www. Ive set the document ...
cbalos's user avatar
  • 123
2 votes
0 answers
2k views

Upstream prematurely closed FastCGI stdout while reading response header from

I have a setup of nginx1.20.1 + php7.3.3 on Centos7. We run those VMs beneath google cloud load balancer. Sometimes, randomly there is 502 returned to the end client. I traced one of those error ...
Tim's user avatar
  • 41
2 votes
4 answers
8k views

Proxy Error 502 "Error reading from remote server" Apache 2.4.18 Ubuntu with HTTPS into Docker container

I'm no expert and can't see what's the problem, but obviously this error is caused by a tiny detail it seems I can't debug. Any idea? What I have: I have multiple virtual hosts configured with Apache2 ...
Julien G's user avatar
2 votes
0 answers
5k views

Squid 502 errors

I am using Squid 3.3.13 with no cache enabled and all my clients in LAN are using it to access to HTTP and HTTPS websites. I am not using it as transparent proxy but clients have it configured in OS ...
Mat's user avatar
  • 1,893
2 votes
0 answers
307 views

How to distinguish between internal error code 502 and upstream returned http_502 on a nginx proxy

We use nginx as a http proxy server.The following configuration: location / { proxy_pass_header Server; proxy_pass $scheme://$http_host$request_uri; } When urls proxied return error code 502 ...
user2978978's user avatar
2 votes
1 answer
1k views

Apache RewriteRule 502 Error on dev server, works on live

I'm on Apache 2.2.15. My vhost.conf contains a RewriteRule to handle article URLs; # handling for neat article titles RewriteRule ^/news/[0-9]{4}/[A-za-z]{3}/([0-9a-zA-Z-]*)/([0-9]{4})([0-9]{6})/?$ "/...
sauntimo's user avatar
  • 153
1 vote
1 answer
2k views

Wordpress import process ends in 502 Bad Gateway error

I have a Wordpress website which have been working flawlessly for a while now in a LEMP with Ubuntu. However, today I had to import a previously exported XML from another Wordpress and in the middle ...
Alain's user avatar
  • 135
1 vote
1 answer
1k views

502 error when wordpress site hosted on AWS, but not Google cloud

I've got a problem with my wordpress site that means I get a 502 bad gateway error. The site is hosted on AWS (EC2 instance). I migrated the site to a google cloud instance to test if that would ...
Lisa's user avatar
  • 21
1 vote
1 answer
15k views

502 bad gateway nginx and apache servers

Hello there can you please help me im trying to setup apache and nginx server on my ubuntu 16.04 server, but when i try to visit localhost/info.php fo example im getting 502 Bad Gateway nginx/1.9....
Dimitar's user avatar
  • 123
1 vote
1 answer
2k views

502 errors on random (not all) pages

A few weeks ago I noticed in the Google Webmaster tools that a few of my URL's were returning 502's. One such URL is http://www.sau.com.au/forums/topic/437438-around-the-bay-wrap-up/ This URL ...
Christian's user avatar
  • 789
1 vote
1 answer
12k views

HTTP 502 Bad Gateway error response

I'm debugging an issue and running out of ideas. I have a server with SharePoint code hosted at port 8080 and a WCF REST service at port 8801. From another machine on the domain, I can connect to the ...
MvdD's user avatar
  • 173
1 vote
1 answer
3k views

php-fpm + persistent sockets = 502 bad gateway

Put on your reading glasses - this will be a long-ish one. First, what I'm doing. I'm building a web-app interface for some particularly slow tcp devices. Opening a socket to them takes 200ms and an ...
leeoniya's user avatar
  • 147
1 vote
0 answers
157 views

Apache HTTP proxy work for some destination ip and receive 502 Bad Request from other destinations

I've an HTTP proxy like this: Listen 8240 <VirtualHost *:8240> ProxyRequests On <Proxy "*"> SetEnv force-proxy-request-1.0 1 SetEnv proxy-nokeepalive 1 </Proxy> </...
alex's user avatar
  • 11
1 vote
0 answers
47 views

My web application is running on One Server and two worker nodes

my nginx config file is server { listen ip-address:80 ; server_name subdomain.domain.com; server_name www.subdomain.domain.com; server_name ipv4.subdomain.domain.com; ...
MUmar's user avatar
  • 11
1 vote
0 answers
2k views

Listening to 127.0.0.1:9000 but var/run/php5-fpm.sock failed (2: No such file or directory)

I have a webserver configured to accept FastCGI requests at 127.0.0.1:9000 like below. /etc/php5/fpm/pool.d/www.conf: listen = 127.0.0.1:9000 /etc/nginx/sites-enabled/mysite: location ~ .php$ { ...
laketuna's user avatar
  • 125
1 vote
2 answers
428 views

nginx default error page stopped working for some reason

This used to work: server { server_name example.com; location / { proxy_pass http://localhost:8888; error_page 502 /502.html; } location = /502.html { root /var/www/example; } ...
davidhq's user avatar
  • 215
1 vote
1 answer
4k views

502 Error When Trying to Post/Update in Wordpress After HHVM Installation

I'm hoping someone can lead me in the right direction of how to track down this problem. I recently had HHVM installed on my server with PHP as a fallback. Since then I've been having issues in WP ...
DRK's user avatar
  • 11
1 vote
2 answers
3k views

UWSGI Bad Gateway - Connection refused while connecting to upstream

Trying to get a basic Django app running on nginx using UWSGI. I keep getting a 502 error with the error in the subject line. I am doing all of this as root, which I know is bad practice, but I am ...
HectorOfTroy407's user avatar
1 vote
1 answer
24k views

504 Gateway timeout / 502 Bad gateway after installing php curl - server nginx

I have (well had) a working server with nginx on board. A server (dedicated) was only used to host a drupal site. Recently we decided to host also a magento store on it and started preparation. Since ...
Szymon Łazaruk's user avatar
1 vote
2 answers
2k views

Error 502 - Random SSL Library Error: 336151568 error:14094410

I'm facing a random 502 error on my webservers. Rate : 0.5% Error in my logs: SSL Library Error: 336151568 error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure OpenSSL Version :...
foru's user avatar
  • 11
0 votes
1 answer
1k views

phpmyadmin error 502 Bad Gateway on nginex

i just installed phpmyadmin on my ubuntu 20.04 server but when I try to go to the site I have a 502 bad gateway error ... here is what I have in my LOG file : 2021/02/05 14:43:33 [crit] 662288#662288: ...
hari's user avatar
  • 1
0 votes
2 answers
8k views

NGINX and PHP-FPM 502 bad gateway

Ok so here is the situation, we currently have a server and we are now migrating to AWS. We have somehow identical configuration and we already tried to run apache benchmark so the PHP-FPM pool is ...
Rei's user avatar
  • 23
0 votes
2 answers
1k views

Nginx throws 502 intermittently on every page when using fastcgi_finish_request()

I recently inherited administration over 2 Nginx boxes in AWS and am very unfamiliar with how PHP-FPM works (and doens't work). I recently integrated Keen.IO for backend user logging, using: ...
David's user avatar
  • 103