Uly.me

cloud engineer

  • Home
  • About
  • Archives
Home/Linux/Multiple VirtualHosts

March 10, 2018

Multiple VirtualHosts

Here’s the proper way to host multiple websites (domains) on single host with a single IP address. Technically, you can have multiple Apache configuration files that you can enable within Apache, but you can easily simplify and combine them into a single Apache configuration file. You can separate each domain by creating multiple virtualhost sections as shown in the example below.

<VirtualHost *:80>
    DocumentRoot "/www/example1"
    ServerName www.example.com
    # Other directives here
</VirtualHost>
 
<VirtualHost *:80>
    DocumentRoot "/www/example2"
    ServerName www.example.org
    # Other directives here
</VirtualHost>

<VirtualHost *:80> DocumentRoot "/www/example1" ServerName www.example.com # Other directives here </VirtualHost> <VirtualHost *:80> DocumentRoot "/www/example2" ServerName www.example.org # Other directives here </VirtualHost>

If you’re interested, read up on Apache’s website about virtual hosts.

Filed Under: Linux

Have content delivered to your mail. Subscribe below.

About Me

I'm Ulysses, Cloud Engineer at Cardinal Health based in Columbus. This blog is about Linux and Cloud technology. When off the grid, I enjoy riding my electric skateboard. I've surfed, snowboarded and played the saxophone in the past. I hope you find this website helpful. It's powered by WordPress and hosted on AWS LightSail.

  • Cloud
  • Linux
  • Git

Copyright © 2012–2021