CAll Us: +91 88 00 563434   Login

Setup Multiple WordPress Sites on one host a single VPS

You are here:
  • Main
  • Wordpress
  • Setup Multiple WordPress Sites on one host a single VPS
< All Topics

VPS stands for Digital Personal Server, often known as VM(Digital Machine). We will additionally name these VPS/VMs a number for our WordPress websites as they maintain our WordPress information and knowledge. On this tutorial, I’ll present you how one can configure a number of WordPress websites on one Host or a single VPS.

You may also use VPS to host all of the WordPress web sites that you just personal. It’s price efficient in addition to your WordPress web sites can get all of the sources they should carry out as quick as doable.

This can be a step-by-step information you could observe with few stipulations. Here’s what you could observe this information.

  • A VPS/VM with Apache, MySQL and PHP (LAMP server) put in.
  • Root entry to the server.

Word: Comply with this information to Set up LAMP server on Ubuntu.

We want root entry to carry out this process as we now have to create just a few information referred to as digital hosts. As soon as you might be prepared with a server having Apache, MySQL and PHP with root entry, we will get began.

Create DocumentRoot for WordPress web sites

Doc root is a listing by which we will retailer our web site information. In case of WordPress, we are going to retailer WordPress information contained in the doc root of a selected web site. I’ll use instance.com and example2.com as domains on this tutorial. Don’t forget to exchange these domains with yours.

On this tutorial, I’ll create Doc roots inside /var/www listing. However you may as well create doc root in a consumer’s dwelling listing in case you wish to isolate the WordPress installations. Execute the next command to create doc roots in addition to listing to retailer error and entry logs of two web sites.

mkdir -p /var/www/instance.com,example2.com/logs,public_html

The -p flag within the command permits us to create nested directories. On this case, It’s permitting us to create logs and public_html directories inside each instance.com and example2.com directories.

Right here, the public_html listing inside each the father or mother listing is called doc root. As our doc roots are prepared, we will create a pattern index file for each the web sites. Execute the next instructions to carry out the duty.

echo “Hey world from instance.com” >> /var/www/instance.com/public_html/index.html
echo “Hey world from example2.com” >> /var/www/example2.com/public_html/index.html

As soon as created, we will transfer on to create digital hosts for each the web sites.

Create Digital Hosts for WordPress web sites

Digital hosts are the configuration information that tells our internet server to route requests based mostly on the area identify to their revered listing. It additionally tells the net server what file to search for, what guidelines to use and the place to retailer error and entry logs for the precise web site or digital host.

As we now have two web sites to host proper now, We now have to create two information for 2 completely different domains on the beneath given location and content material.

  • Location: /and so forth/apache2/sites-available/instance.conf
  • Content material:

<VirtualHost *:80>

ServerAdmin instance@e mail.com
ServerName instance.com
ServerAlias www.instance.com
DocumentRoot /var/www/instance.com/public_html

ErrorLog /var/www/instance.com/logs/error.log
CustomLog /var/www/instance.com/logs/entry.log mixed

<Listing />

Choices FollowSymLinks
AllowOverride None

</Listing>

<Listing /var/www/instance.com/public_html>

Choices -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
Permit from all

</Listing>

</VirtualHost>

Don’t forget to exchange instance.com along with your area identify within the file contents in addition to the filename. You possibly can immediately create a file and copy-paste the edited content material by executing the next command.

sudo nano /and so forth/apache2/sites-available/instance.conf

After writing the up to date content material, press CTRL+X adopted by Y to save lots of the file. You need to create this digital host file for all of the domains you wish to host on the VPS. On this case, we now have to create digital host information for instance.com and example2.com.

Now, It’s time to create databases for our WordPress web sites.

Create Databases for WordPress web sites

It is vitally simple to create databases for our WordPress websites as we wouldn’t have to edit or create any file on this half. Log in to the MySQL command line interface utilizing the next command.

mysql -uroot -p;

It can ask you for root password which it is best to know. Upon getting entry to MySQL command line interface, execute the next instructions to create consumer and database for our first WordPress web site.

> CREATE DATABASE instance;
> CREATE USER ‘instance‘@’localhost’ IDENTIFIED BY ‘RANDOM_PASSWORD‘;
> GRANT ALL PRIVILEGES ON instance.* TO ‘instance‘@’localhost’;
> FLUSH PRIVILEGES;

Equally, repeat these instructions to create a database and consumer on your second WordPress web site. Don’t forget to exchange instance and RANDOM_PASSWORD along with your desired database, database username and password.

> CREATE DATABASE example2;
> CREATE USER ‘example2‘@’localhost’ IDENTIFIED BY ‘RANDOM_PASSWORD‘;
> GRANT ALL PRIVILEGES ON example2.* to ‘example2‘@’localhost’;
> FLUSH PRIVILEGES;

As soon as carried out, you may shut the MySQL command line interface utilizing the exit command. Our database and MySQL customers are prepared. Now, We now have to obtain and extract WordPress information in our doc root.

Additionally, Word down the username, database identify and the password as we are going to want it in future to create the WordPress configuration file.

Obtain and Extract WordPress information

The subsequent factor we now have to do is to take away the fundamental index information we now have created within the public_html listing of each of our web sites. We additionally need to obtain and extract WordPress information in order that we will set up WordPress by immediately accessing the URL within the browser.

Execute the next instructions to take away the fundamental index file, Obtain the Newest WordPress and extract WordPress information within the doc root.

cd /var/www/instance.com/public_html
rm -rf index.html
wget https://wordpress.org/newest.tar.gz
tar -xzvf newest.tar.gz
mv wordpress/* ./
rm -rf wordpress newest.tar.gz

Equally, we now have to execute these instructions to carry out the identical process for one more area too.

cd /var/www/example2.com/public_html
rm -rf index.html
wget https://wordpress.org/newest.tar.gz
tar -xzvf newest.tar.gz
mv wordpress/* ./
rm -rf wordpress newest.tar.gz

Upon getting carried out this process for each the web sites/domains, Execute the next instructions to set the possession of the information. We have to give possession of the information to the net server in order that we will enable WordPress to create, handle and delete information and directories in our WordPress set up listing.

chown -R www-data:www-data /var/www/instance.com
chown -R www-data:www-data /var/www/example2.com

The very last thing we now have to do on this step of the setup is to allow each the digital hosts in order that our internet server can begin routing visitors based mostly on the area identify. Execute the next instructions to allow the digital hosts in Apache.

a2ensite instance.conf
a2ensite example2.conf

Word that we now have to make use of the very same digital host file names right here. You may also take away .conf from the top of the filename and it’ll nonetheless work. After executing each the instructions, execute the next command to reload the Apache configuration to use the adjustments.

service apache2 reload

Lastly, all of the configuration half is completed. Now, we simply have to put in WordPress from the browser.

Set up WordPress from Browser

Now, all we now have to do is to entry our domains within the browser one-by-one and enter the database info to create a WordPress configuration file.

So, open up a brand new tab in your browser and entry any one of many area identify you are attempting to configure on the server. You need to see a display similar to the next picture.

WordPress installation - step 1

On this step, choose the language you might be snug with and hit the Proceed button given on the underside of the cardboard. Within the subsequent step, click on on the Let’s Go! button after which it is best to see a display similar to the next picture.

WordPress installation - Step 2

On this type, Enter the data of database and database consumer we simply created. On this case, I’ve entered the data I’ve used to create the database for instance.com. If the database info you might be coming into is right, you will note a display similar to the next picture after clicking the Submit button.

WordPress installation - Part 3

Click on on the Run the set up to set your WordPress Title, WordPress username, WordPress password and another settings like these.

WordPress installation - Step 4

Lastly, Click on on the Set up WordPress button given after the shape to put in WordPress on the primary area identify.

Now, entry the one other area identify within the new tab of your browser and repeat the identical WordPress set up steps to put in WordPress on one other web site too.

Conclusion

Congratulations, You have got efficiently configured two WordPress websites on one host or a single VPS. And the excellent news is, you may add as many web sites as you need on a single VPS. If you wish to add third web site on a similar VPS, Comply with these steps:

  • Create doc root in /var/www listing with two sub-directories named logs and public_html.
  • Create a digital host file inside /and so forth/apache2/sites-available similar to we created for these two web sites.
  • A database to retailer knowledge of your third WordPress set up.
  • Obtain and extract WordPress information in a doc root of your third web site.
  • Set up WordPress out of your browser by accessing the URL of your third web site.

That’s all it takes to configure a number of WordPress websites on one host or a single VPS. It’d go fallacious a primary few instances and also you would possibly face some points however when you perceive the method, it’s going to turn into very simple to configure a number of WordPress websites on one host.

In case you are dealing with any concern with setup, Please contact our assist for assist.

Knowledge Base