i want to host first 2 domain in single droplet like domain1.com => /var/www/html/ and domain2.com=>/var/www/html/admin/
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.
@yWalker
This is very easy using apache virtual hosts
Follow these instructions to achieve what you want
sudo cp /etc/apache2/siates-available/000-default.conf /etc/apache2/sites-available/domain1.com.conf
ServerName domain1.com
ErrorLog ${APACHE_LOG_DIR}/domain1.com_error.log
DocumentRoot /var/www/html/
CustomLog ${APACHE_LOG_DIR}/domain1.com_access.log combined
domain2.com.conf
domain1.com
withdomain2.com
also do not forget to changeDocumentRoot
to/var/www/html/admin
sudo a2ensite domain1.com.conf
,domain2.com.conf
.sudo service apache2 restart
Now you can use
domain1.com
to access the site at/var/www/html
anddomain2.com
to access the site at/var/www/html/admin
Hope this helps, revert back here for any further questions.
What is your webserver of choice.
I personally use NGINX.
https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-16-04