How to create sub domains: (with Droplet setting up)
1) cd /var/www/
2) mkdir subdomain
3) chmod -R 775 subdomain
4) cd subdomain
5) sudo nano index.php (inside the file) <? php echo ‘subdomain test’; ?> (control X to save)
6) in NETWORKING create A entries for subdomain = subdomain> droplet> 3600
7) in NETWORKING create CNAME entries for subdomain = www.subdomain> subdomain.dominium> 43200
8) cd ~
9) cd /etc/apache2/sites-available/
10) type: “cp 000-default.conf subdomain.domain.conf”
11) type: sudo nano subdomain.domain.conf
12) Within the copied file, change: 12.1 = remove “#” from ServerName and leave as: “ServerName subdomain.dominium” 12.2 = enter ServerAlias: “ServerAlias www.subdomain.domain” 12.3 = change “DocumentRoot” to: “DocummentRoot / var / www / subdomain” (control X to save - confirm by pressing Y and then enter the filename subdomain.dominio.conf)
13) type: “sudo a2ensite subdomain.domain.conf”
14) Restart server to terminate = “sudo service apache2 restart”
READY! Now access the subdomain link and see the message from the PHP file from step 5.
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.
That’s great! Thanks for sharing this step by step guide with the community!
Regards, Bobby
Hi Emerson, Bobby
Would you, please, make a version to nginx?
Does subdomain inherit SSL configuration?
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.
