Question

Setting up multiple sites on multiple subdomains

Posted February 27, 2020 45 views
NginxWordPress

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.

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.

×
1 answer

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;
Submit an Answer