Apache’s ProxyPass on Ubuntu

  1. Install apache2. On Ubuntu type:
     # apt-get install apache2
  2. Activate mod_proxy:
     # a2enmod proxy
  3. Create a new file in /etc/apache2/sites-available, named metak (or whatever):
    NameVirtualHost *
    <Virtualhost *>
      DocumentRoot "/var/www/metak"
      ServerName localhost
      ServerAdmin support@mycompany.com
      DirectoryIndex index.html index.phpProxyRequests On
      ProxyPreserveHost On
      ProxyVia full
        Order deny,allow
        Allow from all
      ProxyPass        /  http://www.metak.com
      ProxyPassReverse /  http://www.metak.com
  4. Enable the new site and restart apache2:
    # a2ensite metak
    # /etc/init.d/apache2 reload

6 Responses to Apache’s ProxyPass on Ubuntu

  1. Thanks that helped. It seems to me that

    ProxyPass / http://www.metak.com

    should have a slash at the end

    ProxyPass / http://www.metak.com/

    since otherwise links to a page page.html become http://www.metak.compage.html (slash missing).


  2. I needed a2enmod proxy_http as well

  3. brice says:

    I confirm:

    – end / needed for ProxyPass & ProxyPassReverse
    – a2enmod proxy_http needed

    … and it will work like a charm

  4. kamal says:

    Thanks for your post. This post is helpful.

    You should proxy and proxy_http at the beginning then it will work easily and if you have default site in your available site folder , you need to disable the default site.

    the code will be

    sudo a2enmod proxy
    sudo a2enmod proxy_http

    sudo a2dissite default

  5. Miguel Ortiz says:

    Thanks, really usefull !!! i didn’t figure out how to install it ’til read this.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: