Tuesday, December 25, 2012

How to Implement Reverse Proxy With Mod Security



This post is related to the project that i did with Mod_Security & Reverse Proxy , you can refer to this post that i already describe the details of "How To Install Mod_Security On Apache(Ubuntu 12.10) Step By Step Tutorial For Beginners".
In this post i will give the example configuration for the "reverse proxy" of the same project that i mention above:

First you need to run following command to install and enable the Reverse Proxy.
sudo a2enmod proxy proxy_http

Now you have to go to the following path for changing the configuration of the reverse proxy.
/etc/apache2/sites-available.

Change the content of file with following lines:

<VirtualHost *:80>
        ServerAdmin [email protected]
        ServerAlias www.myexample.net
        ServerName myexample.net

        ErrorLog /var/log/apache2/example-error.log

        LogLevel info
        CustomLog /var/log/apache2/example-access.log combined
         
        ProxyPreserveHost On
        ProxyRequests off
        # Allow from everywhere
        <Proxy *>
                Order deny,allow
                Allow from all
        </Proxy>
       # Send all requests to port 1122
ProxyPass /audit !
        ProxyPass / http://10.10.150.4:80/
        ProxyPassReverse / http://10.10.150.4:80/
</VirtualHost>

This configuration will get any request on port 80 and forward them on http://10.10.150.4:80. And as  we had a php script inside this machine and we need to open that from this machine not the destination machine so we need to make a exception for that directory. "ProxyPass /audit !" will stop reverse proxy to forward requests related to /audit/ directory to the destination machine and will run it from the current machine!

Now by running the following command restart the Apache to changes take effect:
sudo service apache2 restart

And this is the video of this project that i describes the details about how this project works.
http://www.youtube.com/watch?v=o3-KDD7TSrA

12 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. A debt of gratitude is in order for the blog entry amigo! Keep them coming... vpn

    ReplyDelete
  3. New site is solid. A debt of gratitude is in order for the colossal exertion. best hytale mod

    ReplyDelete
  4. Awesome article, it was exceptionally helpful! I simply began in this and I'm becoming more acquainted with it better! Cheers, keep doing awesome! 代理翻墙软件

    ReplyDelete
  5. Excellent Blog! I would like to thank for the efforts you have made in writing this post. I am hoping the same best work from you in the future as well. I wanted to thank you for this websites! Thanks for sharing. Great websites! vpn 翻墙

    ReplyDelete
  6. It should be noted that whilst ordering papers for sale at paper writing service, you can get unkind attitude. In case you feel that the bureau is trying to cheat you, don't buy term paper from it. 中国 vpn
    中国 vpn

    ReplyDelete
  7. I like your post and I think I have seen some website which is similar to yours:
    中国 vpn

    ReplyDelete
  8. The other kind of catch mod is known as a trigger catch mod. Essentially, this kind of regulator permits you to utilize the catches to turn on the actual mod, just as change modes. KineMaster Mod APk

    ReplyDelete
  9. ExpressVPN is a well-regarded VPN软件 used by many people – but how well does it actually perform?

    ReplyDelete
  10. There are a great number of internet based companies that use to sell such proxies to other people for their home or work use. visit our website

    ReplyDelete

Social Networks Sharing