Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reverse Proxy with Apache on Centos 6

I'm trying to forward an URL to another server using Apache. I created a virtual host in the httpd.conf. It's not working when I try to access ipServeur/test. I can't access the page.

What is wrong?

NameVirtualHost *:80 
<VirtualHost *:80>
    ServerName ipServeur
    ProxyRequests off
    ProxyPass /test http://ipOtherServeur:8080
    ProxyPassReverse /test http://ipOtherServeur:8080
</VirtualHost>
like image 204
ZheFrench Avatar asked Jul 31 '14 09:07

ZheFrench


Video Answer


1 Answers

From apache's wiki :

This error is not really about file permissions or anything like that. What it actually means is that httpd has been denied permission to connect to that IP address and port.

The most common cause of this is SELinux not permitting httpd to make network connections.

To resolve it, you need to change an SELinux boolean value (which will automatically persist across reboots). You may also want to restart httpd to reset the proxy worker, although this isn't strictly required.

To allow apache to make network connections issue the following command.

sudo /usr/sbin/setsebool httpd_can_network_connect 1

Then restart apache.

sudo service httpd restart
like image 132
cjungel Avatar answered Nov 03 '22 20:11

cjungel