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

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


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

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.


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.