Search code examples
apacheproxy

Proxying with Apache2


I've read many different threads here, read the official manual, but nothing has worked. Here is the problem: I have a website running on port 80, I need to open the website located at http://<server2_IP>/ when accessing http://<server1_IP>/ws/.

I tried to do it using this config:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        ProxyRequests off
        ProxyPreserveHost On
        ProxyPass "/ws" "http://<server2_IP>/"
        ProxyPassReverse "/ws" "http://<server2_IP>/"
</VirtualHost>

But nothing worked and when opening /ws on the main website I get a 404 error. I don't use the ServerName field, because the website works only in the local network


Solution

  • It's solved - I'm dumb as fk. For some reason the sites were disabled and I was seeing the default apache stub. After a2ensite 000-default.conf everything worked