Question

Is it possible to install another wordpress on droplet?

Hi,

I was wondering if I can install another wordpress site on the same droplet after the first “one-click” install (ubuntu + wp). And how to do it the easiest way.


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.

Ryan Quinn
DigitalOcean Employee
DigitalOcean Employee badge
July 18, 2016
Accepted Answer

It is. Here are the steps to accomplish this.

1. Create a second Database.

Connect to your droplet via ssh and use your current MySQL root password (this can be found in the MOTD displayed when you first log in via ssh and is also in /etc/motd.tail).

mysql -uroot -p

Enter your MySQL root password and then…

create database wordpress2;
CREATE USER wordpressuser2@localhost IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON wordpress2.* TO wordpressuser2@localhost;
FLUSH PRIVILEGES;
exit;

You now have a new database and a user that can access it. Hold onto that information as you will need it in the last step to complete your setup.

2. Make a new web root directory

Next you’ll need to create a directory for the new site and place WordPress’ files in that location.

mkdir /var/www/wordpress2;
wget https://wordpress.org/latest.tar.gz -O /tmp/wordpress.tar.gz;
tar -zxf /tmp/wordpress.tar.gz  -C /tmp;
mv -f /tmp/wordpress/* /var/www/wordpress2;
chown -Rf www-data.www-data /var/www/wordpress2;

Once we’ve run these commands we will have a copy of the latest version of WordPress downloaded into our /var/www/wordpress2 directory and owned by www-data.

3. Create a new VirtualHost in Apache

Next we’ll need to set Apache up to serve our new site when it’s domain is requested. Before we do that however, the configuration file created by the one-click will need a quick update. Open the file /etc/apache2/sites-enabled/000-default.conf and make the adjustments shown in red using your existing site’s domain name in place of example.org.

<VirtualHost *:80>
        ServerAdmin webmaster@example.org
        ServerName example.org
        ServerAlias www.example.org
        DocumentRoot /var/www/html

        <Directory /var/www/html/>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Save those changes. Now create a file called /etc/apache2/sites-enabled/yoursite.conf and make it look like this (where example2.org is replaced with your new site’s domain name):

<VirtualHost *:80>
        ServerAdmin webmaster@example2.org
        ServerName example2.org
        ServerAlias www.example2.org
        DocumentRoot /var/www/html

        <Directory /var/www/html/>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Once these changes are made, restart Apache with the command:

service apache2 restart

4. Set up DNS

Now you can point your new domain name to your droplet. This guide will assist you in creating DNS records.

5. Complete setup

Now we can set up the new WordPress installation. Open a web browser and browse to your new site’s domain name. You should be prompted to continue the setup of your new WordPress site. Use the database details you set up in step one above.

That’s it. You now have two separate WordPress sites running on your droplet.

If you’re running into an issue with your second website redirecting to your first website, just re-setup Let’s Encrypt with the following:

sudo certbot --apache 

Once you install SSL for each domain then it will no long redirect.

hello, i am stuck with step 3 i can’t open “/etc/apache2/sites-enabled/000-default.conf” on my terminal can you please describe how can i exactly do step 3 please.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel