Hello members, can one host several projects for instance 3, on the same droplet using subdomains? I’m using Apache as web server. I would wish to serve three sites as follows:
sub_1.example.com sub_2.example.com sub_3.example.com
Your assistance will be highly appreciated.
This textbox defaults to using Markdown to format your 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.
Hey @samunyi90,
Yes, you can definitely host multiple sites on the same DigitalOcean Droplet using subdomains. Apache allows this through a feature called VirtualHosts. A VirtualHost can be configured for each subdomain. Below are the general steps you would need to take:
Make sure you set appropriate permissions for these directories.
Inside this file, you would put:
Save and close the file.
Do the same for sub_2 and sub_3, just replace
sub_1
withsub_2
andsub_3
respectively in the above steps.That’s it! You now have three sites being served from the same Droplet, each from their own subdomain. If you have SSL certificates, you can configure each VirtualHost to also listen on port 443 and point to the respective certificates. This setup can be repeated for any number of sites you need to host.