LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 03-06-2021, 12:53 PM   #1
n00b_noob
Member
 
Registered: Sep 2020
Posts: 436

Rep: Reputation: Disabled
Post Apache Reverse Proxy show "Service Unavailable" error.


Hello,
I created two VMs in the VirtualBox. One of them is Reverse Proxy server and another one is Apache Web Server.
The specifications of VM1 (Reverse Proxy) are as follows:
NIC 1 is NAT and Its IP address is "10.0.3.15".
NIC 2 is Internal Network and its IP address is "192.168.1.3".

The specifications of VM2 (Apache Web Server) are as follows:
It has one NIC and its IP address is "192.168.1.4".

Both VMs can see each other. I installed Apache Web Server on the both machines and opened ports 80 and 443 via Firewalld on them:
Code:
# firewall-cmd --list-all
FedoraServer (active)
  target: default
  icmp-block-inversion: no
  interfaces: enp0s3
  sources: 
  services: cockpit dhcpv6-client ssh
  ports: 80/tcp 443/tcp
  protocols: 
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules:
My goal is:
Code:
The Internet --> Reverse Proxy (VM1) --> Apache Web Server (VM2)
On the VM1, I did:
Code:
# curl http://192.168.1.4
<html>
	<head>
		<title> This my server. </title>
	</head>
	<body>
		<p> Hello Server. </p>
	</body>
</html>
And as you see, it can see VM2 Apache Web Server.
On the VM1, I created a Virtual Host configuration file as below:
Code:
# touch /etc/httpd/conf.d/reverse.conf
# nano /etc/httpd/conf.d/reverse.conf
And filled it with below lines:
Code:
<VirtualHost *:80>

        ProxyPreserveHost On
        ProxyPass / http://192.168.1.4/
        ProxyPassReverse / http://192.168.1.4/

</VirtualHost>
Then restarted the Apache Web Server.
When I entered VM1 IP address, then I must see the VM2 "index.html" file, but I see below error:
Code:
Service Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
On VM1, I used VirtualBox Port Forwarding:
Code:
Protocol        Host IP        Host Port        Guest IP        Guest Port    
TCP             127.0.0.1      2080             10.0.3.15       80
When I enter "127.0.0.1:2080" in my browser, then logs on VM1 are:
Code:
# cat access_log 
10.0.3.2 - - [06/Mar/2021:22:03:01 +0330] "GET / HTTP/1.1" 503 299 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36"
10.0.3.2 - - [06/Mar/2021:22:03:01 +0330] "GET /favicon.ico HTTP/1.1" 503 299 "http://127.0.0.1:2080/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36"
And:
Code:
# cat error_log 
[Sat Mar 06 22:03:01.275035 2021] [proxy:error] [pid 851:tid 1036] (13)Permission denied: AH00957: HTTP: attempt to connect to 192.168.1.4:80 (192.168.1.4) failed
[Sat Mar 06 22:03:01.275093 2021] [proxy_http:error] [pid 851:tid 1036] [client 10.0.3.2:33820] AH01114: HTTP: failed to make connection to backend: 192.168.1.4
[Sat Mar 06 22:03:01.320469 2021] [proxy:error] [pid 850:tid 990] (13)Permission denied: AH00957: HTTP: attempt to connect to 192.168.1.4:80 (192.168.1.4) failed
[Sat Mar 06 22:03:01.320528 2021] [proxy_http:error] [pid 850:tid 990] [client 10.0.3.2:33822] AH01114: HTTP: failed to make connection to backend: 192.168.1.4, referer: http://127.0.0.1:2080/
On VM2:
Code:
# cat access_log 
#
# cat error_log 
#
Why?

Thanks.
 
Old 03-07-2021, 05:12 AM   #2
n00b_noob
Member
 
Registered: Sep 2020
Posts: 436

Original Poster
Rep: Reputation: Disabled
Problem solved.
It was because of SELinux:
Code:
# setsebool -P httpd_can_network_connect on
 
  


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
Newbie with Apache Server question "ervice - The Apache HTTP Server" vs. "Service - The Apache HTTP Server" HYEARWOOD Linux - Newbie 5 10-17-2017 02:38 AM
Nginx Reverse proxy on a internal apache reverse server ITiger Linux - Software 0 04-25-2014 07:44 AM
SMTP Relaying "Service Unavailable" Mycado Linux - Server 2 11-21-2013 08:07 PM
from where the message " Service Unavailable - Zero size object " is comming ratotopi Linux - Software 0 06-21-2012 05:29 PM

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

All times are GMT -5. The time now is 08:16 PM.

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