LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-11-2021, 05:12 AM   #1
Winanjaya
Member
 
Registered: Sep 2003
Posts: 239

Rep: Reputation: 32
Apache 2.4 (CentOS 7) apache issue ah01114: http: failed to make connection to backend: localhost gak bs rev


Hi All,

I am getting: tons of AH01114: HTTP: failed to make a connection to backend: localhost in /var/log/http/error.log

what happening?

==
<VirtualHost *:80>
ServerName xxx.xxxxx.xxx
ServerAlias xxx.xxxxx.xxx

ServerAdmin xxx@xxx.xxxx
DocumentRoot /var/www/html/xxxx

<Directory /var/www/html/xxxx
Options -Indexes +FollowSymLinks
AllowOverride All
</Directory>^M

ErrorLog ${APACHE_LOG_DIR}/xxx.xxxx.xxx-error.log
CustomLog ${APACHE_LOG_DIR}/xxxx.xxx.xxx.access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =xxx.xxx.xxx
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
Redirect permanent / https://xxx.xxx.xxx
</VirtualHost>


<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName xxxx.xxx.xxx
ServerAlias xxxx.xxx.xxx
ServerAdmin xxx@xxxx.xxx
DocumentRoot /var/www/html/xxxx

<Directory /var/www/html/xxxx
Options -Indexes +FollowSymLinks
AllowOverride All
</Directory>

SSLEngine On
SSLProxyEngine On
ProxyRequests Off
ProxyPreserveHost On

ProxyPass / http://localhost:5000/
ProxyPassReverse / http://localhost:5000/

..
....
....
</VirtualHost>
</IfModule>
~
~

~

==
 
Old 06-11-2021, 07:16 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
<snip>
ProxyPass / http://localhost:5000/
ProxyPassReverse / http://localhost:5000/
<snip>
You have setup the vhost xxx.xxxxx.xxx as a reverse proxy for an application running on the same host and listening on port 5000.

So make sure that this application (whatever it is), is indeed running and listening on port 5000 on the local loopback interface
 
Old 06-11-2021, 12:04 PM   #3
Winanjaya
Member
 
Registered: Sep 2003
Posts: 239

Original Poster
Rep: Reputation: 32
yes, the app is running and listening on port 5000, but don't know why I got that error
 
Old 06-11-2021, 02:58 PM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Originally Posted by Winanjaya View Post
yes, the app is running and listening on port 5000, but don't know why I got that error
Are you sure it's listening on the local loopback interface?
What gives:
Code:
netstat -tanpl|grep 5000
 
Old 06-12-2021, 07:21 PM   #5
Winanjaya
Member
 
Registered: Sep 2003
Posts: 239

Original Poster
Rep: Reputation: 32
Yes, it is listening (see the screenshot)
Attached Thumbnails
Click image for larger version

Name:	3E6C6B09-5531-4904-B8C9-83DBCBAD1F96.jpg
Views:	541
Size:	257.4 KB
ID:	36597  
 
Old 06-13-2021, 02:00 AM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Originally Posted by Winanjaya View Post
Yes, it is listening (see the screenshot)
Then maybe your box does not resolve localhost to 127.0.0.1.
Check /etc/hosts and/or change the apache proxypass directives to:
Code:
ProxyPass / http://127.0.0.1:5000/
ProxyPassReverse / http://127.0.0.1:5000/
 
Old 06-14-2021, 12:08 AM   #7
Winanjaya
Member
 
Registered: Sep 2003
Posts: 239

Original Poster
Rep: Reputation: 32
Hi,

the problem still occurs:

[Mon Jun 14 11:55:01.253497 2021] [proxy:error] [pid 392251:tid 140209995896576] (99)Cannot assign requested address: AH00957: HTTP: attempt to connect to 127.0.0.1:5000 (127.0.0.1) failed
[Mon Jun 14 11:55:01.253522 2021] [proxy_http:error] [pid 392251:tid 140209995896576] [client 36.67.59.59:35738] AH01114: HTTP: failed to make connection to backend: 127.0.0.1

what happens with my apache?

<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName gps.example.com
ServerAlias gps.example.com
DocumentRoot /var/www/html
ErrorLog /var/log/httpd/error.log
CustomLog /var/log/httpd/requests.log combined

ProxyRequests Off
ProxyPreserveHost On
RewriteEngine On

ProxyPass /gps/v1/api/ http://127.0.0.1:5000/
ProxyPassReverse /gps/v1/api/ http://127.0.0.1:5000/

SSLCertificateFile /etc/letsencrypt/live/gps.example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/gps.example.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
~
 
Old 06-14-2021, 01:30 AM   #8
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
[Mon Jun 14 11:55:01.253497 2021] [proxy:error] [pid 392251:tid 140209995896576] (99)Cannot assign requested address: AH00957: HTTP: attempt to connect to 127.0.0.1:5000 (127.0.0.1) failed
I don't understand the error above? Do you get that error when visiting https://gps.example.com/gps/v1/api/
What happens if you go directly to http://127.0.0.1:5000/ from the same box that runs the apache reverse proxy?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Brother HL-2240-R Stopped - Backend /usr/lib/cups/backend/usb does not exist! jet222jet Linux - Hardware 2 12-28-2020 06:32 PM
apache: http://localhost (work) http://ipaddress (not working) sarmad Linux - Newbie 7 02-05-2013 07:47 AM
Apache: Change http://localhost to http://www.mywebsite.com mlandvo Linux - Server 1 08-12-2010 08:47 AM
Turn KnoppMyth backend/frontend into backend only nebbus Linux - General 0 09-09-2007 01:57 AM
apache http://localhost/mysite ---> http://localhost/mysite/index.php how? ilnli Linux - General 8 06-04-2005 03:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration