Skip to content

Instantly share code, notes, and snippets.

@mortenege
Created March 4, 2018 07:14
Show Gist options
  • Save mortenege/45f89e601bc8e60f22909ddca0cae659 to your computer and use it in GitHub Desktop.
Save mortenege/45f89e601bc8e60f22909ddca0cae659 to your computer and use it in GitHub Desktop.
Swap Apache default site

Swap Apache default site

This post builds on top of this post where we set up reverse proxy in Apache to redirect traffic to a backend of our choice. In this guide we will swap out the default apache site on port 80 with our proxy server. We edit 001-mysite.conf to use port 80 and forward all paths to our backend.

<VirtualHost *:80>
 ProxyPass "/" "http://127.0.0.1:8080/"
 ProxyPassReverse "/" "http://127.0.0.1:8080/"
</VirtualHost>

Notice that we do not add "listen 80" as the server is already configured to listen to this port.

As before we want to enable our site.

$ a2ensite 001-mysite.conf

If we reloaded the server now, this configuration would work, but to not create confusion, we will disable the default configuration.

$ a2dissite 000-default.conf

And then reload the apache service.

$ service apache2 restart

Now our proxy server is accessible on *:80.

Provision with Vagrant

As in the previous guide we will use Vagrant to provision our server. We remove the port-forwarding between port :4568 and port :5000 in vagrantfile, and we add the line disabling the default Apache site before enabling our own site in bootstrap.sh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment