Setting up multiple sites on multiple subdomains

I’m looking to consolidate my dev works into DigitalOcean. I have multiple demo sites (Wordpress, PHP, Nodejs) that I’ll need to use when I show clients samples.

What’s the best way to approach this? Is this a nginx solution?

I wish to have my wordpress or even static sites hosted like this.

For example

I don’t foresee a lot of traffic coming or even databases that increase overtime. I also wish to password protect this sites. For example only each pair of credentials can access each demos.

Should I use nginx to manage the domains and set passwords from there? Any advices or documentation can help.

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.

I would use a subdomain.

You can use regex in your nginx conf setup to make this pretty dynamic;

server_name ~^((?<subdomain>.*)\.)?domain.tld$;


root /var/www/$subdomain/www;