By erikragnar
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.
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!
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.
‘/var/www/html’ in /etc/apache2/sites-enabled/yoursite.conf should be replaced with ‘/var/www/wordpress2’ where yoursite.conf and wordpress2 should be replaced with a name of user’s choosing.
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.
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.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.