In this tutorial, we will show you how to install two WordPress instances on separate virtual servers with Ubuntu 16.04 OS and Apache, PHP and MySQL installed on them, and how to manage them from a single place using the MainWP WordPress plugin. WordPress is one of the most popular free content management systems, written in PHP that allows web developers to build websites for any purpose. The MainWP dashboard plugin will allow you to manage your WordPress websites from one central location and get nearly complete control of all your WordPress based websites from the MainWP Dashboard.
This tutorial was tested and written for an Ubuntu 16.04 VPS, but it should work on any Linux distribution.
This install guide assumes that Apache, MySQL and PHP are already installed and configured on your virtual servers. At the time of writing this tutorial, the latest stable version of WordPress is 4.6.1 and it requires:
- PHP 5.6 or later with the GD graphics library version 2.0.x+, MySQLi and mbstring PHP extensions enabled;
- Apache Web Server >= 2.0 compiled with mod_rewrite module and with the following directives allowed: RewriteEngine, RewriteBase, RewriteCond and RewriteRule.;
- MySQL 5.6 or later or MariaDB version 10.0 or later installed on your virtual servers.
Let’s start with the installation. Download the latest version of WordPress available at https://wordpress.org/latest.tar.gz to the first server and extract it using the following commands:
cd /opt wget https://wordpress.org/latest.zip mkdir -p /var/www/html/wordpress unzip -o latest.zip -d /var/www/html/
Create a new MySQL database for WordPress to use and assign a user to it with full permissions:
mysql -u root -p mysql> CREATE DATABASE wpdb; mysql> GRANT ALL PRIVILEGES ON wpdb.* TO 'wpuser'@'localhost' IDENTIFIED BY 'yOur-passw0rd' WITH GRANT OPTION; mysql> FLUSH PRIVILEGES; mysql> quit
Do not forget to replace ‘yOur-passw0rd’ with a strong password.
Create a new virtual host directive in Apache. For example, create a new Apache configuration file named ‘wordpress.conf’ on your virtual server:
touch /etc/apache2/sites-available/wordpress.conf
Then, run the following command:
ln -s /etc/apache2/sites-available/wordpress.conf /etc/apache2/sites-enabled/wordpress.conf
Or, use the a2ensite to enable the ‘wordpress.conf’ configuration in Apache:
sudo a2ensite wordpress.conf
Edit the ‘wordpress.conf’ configuration file:
vi /etc/apache2/sites-available/wordpress.conf
and add the following lines to it:
<VirtualHost *:80> ServerAdmin admin@yourdomain.com DocumentRoot /var/www/html/wordpress/ ServerName your-domain1.com ServerAlias www.your-domain1.com <Directory /var/www/html/wordpress/> Options FollowSymLinks AllowOverride All </Directory> ErrorLog /var/log/apache2/your-domain1.com-error_log CustomLog /var/log/apache2/your-domain1.com-access_log common </VirtualHost>
Optionally, add/modify the following lines in php.ini configuration file:
memory_limit = 256M default_charset = "UTF-8"
Set the proper file permissions for the Apache web server to write to ‘/var/www/html/wordpress/’ directory:
sudo chown -R www-data:www-data /var/www/html/wordpress/
Enable the Apache2 rewrite module if it is not already done so:
sudo a2enmod rewrite
Restart the Apache web server for the changes to take effect:
service apache2 restart
Copy the wp-config-sample.php file to wp-config.php :
cd /var/www/html/wordpress/ wp-config-sample.php wp-config.php
Edit the wp-config.php file and change:
define('DB_NAME', 'database_name_here'); define('DB_USER', 'username_here'); define('DB_PASSWORD', 'password_here');
to
define('DB_NAME', 'wpdb'); define('DB_USER', 'wpuser'); define('DB_PASSWORD', 'yOur-passw0rd');
Repeat the same installation procedure on the second server where you intend to host the second WordPress website (do not forget to edit the Apache configuration file and replace ‘your-domain1.com’ with the actual domain name hosted on the second server).
[ecko_alert color=”blue”]Get one of our MainWP Hosting Plans and we’ll configure and set up WordPress with MainWP for you, for free![/ecko_alert]
Open your favorite web browser, navigate to http://your-domain1.com , then open a second tab and go to http://your-domain2.com , and follow the easy instructions to finish the WordPress installations on both servers.
Log in to the WordPress administration back-end of the first website, go to Plugins >> Add New >> and search for MainWP plugin, then install and activate the MainWP dashboard plugin. On the next page, click Let’s Go >> select ‘Web Host’ and click continue. If all MainWP dashboard plugin requirements are met, click continue. On the next page select the type of hosting (VPS) and the number of child websites you are
On the next page, click Let’s Go >> select ‘Web Host’ and click continue. If all MainWP dashboard plugin requirements are met, click continue. On the next page select the type of hosting (VPS) and the number of child websites you are
Next, select the type of hosting (VPS) and the number of child websites you are planning to manage (less than 50 or more than 50), then click continue.
Then, follow the instructions and continue with the MainWP dashboard plugin setup according to your needs.
To add a second WordPress website, click on the ‘Add New Site’ button, but make sure to go to the administration back-end of your second website and install and activate the MainWP Child plugin first. You can also turn on the ‘unique security ID’ option from the MainWP settings for extra security.
Then, go to the WordPress administration back-end of your first website. From the MainWP Dashboard plugin , click ‘Add New Site’ and add the URL of the second WordPress website, enter its administrator username and click on the ‘Add New Site’ button.
That is it. You can manage the WordPress installations from a single place using the MainWP plugin now.
Of course, you don’t have to do any of this if you use one of our WordPress VPS Hosting services, in which case you can simply ask our expert Linux admins to install WordPress and configure it so you can manage multiple WordPress sites from a single place. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.
Main WP works fine. Thanks.