Question

Could I host different projects with different languages on the same droplet using different routes of the same domain?

That’s what I was trying to do (using Apache 16) I have two enabled config files.

<VirtualHost *:80>
    ServerAdmin admin@something.com
    ServerName mydomain.com/project_1
    ServerAlias www.mydomain.com/project_1
    DocumentRoot /var/www/project1/public_html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

And the other one (for an entirely different project) would be:

<VirtualHost *:80>
    ServerAdmin admin@something.com
    ServerName mydomain.com/project_2
    ServerAlias www.mydomain.com/project_2
    DocumentRoot /var/www/project2/public_html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

I’ve tried it and it didn’t really work.

Do I need to change my domain droplet records to make it work? Because there’s no option for routes there…

I assume I did something stupid and that this question is very unprofessional, but still, I would love to get some help please :)


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello friend!

Great question! What you would do here is use only one of these, and make it like this:

<VirtualHost *:80>
    ServerAdmin admin@something.com
    ServerName mydomain.com
    ServerAlias www.mydomain.com
    DocumentRoot /var/www
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Now create these two folders: /var/www/project1 /var/www/project2

So traffic to mydomain.com/project1 or www.mydomain.com/project1 loads the contents of /var/www/project1, and so on for each project you need :)

Kind Regards, Jarland