Hey ๐Ÿ‘‹๐Ÿป

My name is Christian, an Agile Developer, living in Trento (IT)

I write good code at Wonderflow

You can follow me on and Github


More about me ๐Ÿค–




Simplest Apache configuration for hosting multiple sites

I want to share the most simple and straightforward configuration that suited my needs for developing locally.


First of all, make a quick backup of your current default file in /etc/apache2/sites-available/ like this:

cd /etc/apache2/sites-available/
          sudo mv default .default.bckp

Now create a new file called default in the sites-available directory with the following content

<VirtualHost *:80>
              ServerName test1.local      #the local hostname
              DocumentRoot /var/www/test1 #the corresponding document root
          </VirtualHost>
          <VirtualHost *:80>
              ServerName test2.local
              DocumentRoot /var/www/test2
          </VirtualHost>

Now add the local hostnames to your /etc/hosts file and youโ€™re good to go!

127.0.0.1       localhost test1.local test2.local




PS: Iโ€™m sure this conf is wonโ€™t fit in a production ready environment, but for a local setup itโ€™s just amazingly simple and effortless.