Setting up a basic web proxy in apache

后端 未结 1 561
小鲜肉
小鲜肉 2020-12-23 21:44

I\'m looking to run Apache as a proxy for web development. I\'m running Mac OS X 10.5.4, which already has Apache 2.2.8 installed and running.

I\'d like to point my

相关标签:
1条回答
  • 2020-12-23 22:19

    The proxy setup that you describe is called a Reverse Proxy.

    This is very easy to set up in Apache, by using the mod_proxy module.

    The fundamental mod_proxy directive to set up a reverse proxy is the ProxyPass. You would typically add the following line to your local Apache configuration file (usually httpd.conf or apache2.conf):

    ProxyPass     /remote/     http://www.mysite.com/
    

    In this case, the browser would be requesting http://localhost/remote/test.php but your local Apache server would serve this by acting as a proxy to http://www.mysite.com/test.php.

    You also need to make sure to have the following configuration lines uncommented in your Apache config file:

    LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
    LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so
    

    Make sure to restart your local Apache service after you do any changes to the config file.

    0 讨论(0)
提交回复
热议问题