Report this

What is the reason for this report?

Setting up multiple sites on multiple subdomains

Posted on February 27, 2020

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.



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.

I would use a subdomain.

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

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

Then;

root /var/www/$subdomain/www;

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.