How to create a subdomain of one click Wordpress in same droplet??

November 5, 2018 936 views
WordPress DigitalOcean One-Click Install Apps Ubuntu

Its almost been an month I'm researching on how to create a subdomain of one click wordpress install in same droplet, but there are no proper tutorials or guide for it. Some help would be appreciated!!

1 Answer
jarland MOD November 5, 2018
Accepted Answer

Hey friend!

While I can't give you a step by step on this, I can help you widen your search. If you're searching for how to do this on our one-click image, you're limiting the results too far. Basically, this is the question you're asking:

"How do I host two Wordpress sites on one LAMP stack?"

What it comes down to are these key points:

  1. You need two separate virtual hosts in Apache.
  2. You need two copies of Wordpress (and two MySQL databases, one for each).

Since you'll be adding a second virtual host, you need the answer to this question:
"How do I set the ServerName and ServerAlias values in my existing virtual host?"

Because, you see, when you only have one site then you don't need Apache to know which site to serve when called by a certain URL. Now that you'll have two sites, you need to edit the virtual host config (should be in /etc/apache2/sites-enabled) and define the ServerName and ServerAlias variables. Perhaps to something like this:

ServerName myfirstdomain.com
ServerAlias www.myfirstdomain.com

After that, it becomes only about answering these questions:
"How do I install Wordpress?"
"How do I create an Apache virtual host?"

If this sounds workable, you can find many tutorials on the subject of those. If it has you scared to death because you don't want to dive that deeply into Linux and Apache (this is okay, and many people feel this way), then you might consider just using a second droplet instead.

Jarland

Have another answer? Share your knowledge.