How do i Host 2 Websites in One Droplets with sub folder

August 13, 2017 1.2k views
Ubuntu Apache Ubuntu 16.04

i want to host first 2 domain in single droplet like => /var/www/html/

2 Answers


This is very easy using apache virtual hosts

Follow these instructions to achieve what you want

  • Copy the default apache site and give it another name using this command: sudo cp /etc/apache2/siates-available/000-default.conf /etc/apache2/sites-available/
  • Modify the default configuration by changing the following options:
    • ServerName
    • ErrorLog ${APACHE_LOG_DIR}/domain1.com_error.log
    • DocumentRoot /var/www/html/
    • CustomLog ${APACHE_LOG_DIR}/domain1.com_access.log combined
  • Repeat step one and name the file as
  • Repeat step two and replace with also do not forget to change DocumentRoot to /var/www/html/admin
  • Enable the two new sites with these two command: sudo a2ensite,
  • Restart apache with this command sudo service apache2 restart

Now you can use to access the site at /var/www/html and to access the site at /var/www/html/admin

Hope this helps, revert back here for any further questions.

by Justin Ellingwood
When using the Nginx web server, server blocks (similar to the virtual hosts in Apache) can be used to encapsulate configuration details and host more than one domain off of a single server. In this guide, we'll discuss how to configure server blocks in Nginx on an Ubuntu...
Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!