N
N
Nikolai Savelyev2017-09-07 17:11:52
Apache HTTP Server
Nikolai Savelyev, 2017-09-07 17:11:52

How to setup proxy in apache?

There are two servers with apache - 192.168.0.138 and 192.168.0.92
All http requests come to the first one. One subdomain needed to be moved to another server on the local network. In the httpd config I wrote the following:

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName rt.site.ru
    ProxyPass / http://192.168.0.92/
    ProxyPreserveHost On
    </VirtualHost>

<VirtualHost *:80>
        ServerAdmin [email protected]
        DocumentRoot /var/www/html
        <Directory  /var/www/html>
                Options FollowSymLinks
                AllowOverride All
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Now it works weird. At first, everything seemed to be as it should be - all requests go to files in the /var/www/html directory on the first server, and only rt.site.ru is proxied to another server. Then, suddenly, other addresses began to be proxyed, for example, when accessing the local address 192.168.0.138, files from the second server are opened.
Where is the mistake? How to set up correctly?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question