How to install WordPress multisite on Centos with Apache

Today we are going to show you the process of installing a WordPress Multisite Site on your Centos. The Multisite WordPress option became available with WordPress 3.0. This feature allows you – the site administrator – to create multiple websites without having to install separate WordPress instances, create separate home directories or separate databases. Or, you can allow other users to create their own websites on your WordPress installation. While these sites do not have their own separate root directories or databases, they do have separate files loaded into directories as well as tables in the database. All users on the (multisite) network can also exchange themes and plugins among themselves. All in all, a very handy feature if you have the needs described above.

For this article, I will assume that you have either installed your server with a full CentOS template (LAMP stack installed) or you have already installed a fully working LEMP on your Centos server.

If this is not the case, then before starting, you can check out the tutorial on how to install a LAMP stack on a CentOS server and just read the manual, or follow the links for the complete WordPress LEMP stack manual and proceed with the installation after that.

First, let’s create an Apache virtual directive. To do this, edit the Apache config file as follows:

# vim /etc/httpd/conf/httpd.conf

ServerAdmin [email protected]
DocumentRoot /var/www/html/yourdomain.ru
ServerName yourdomain.ru
ErrorLog /var/log/httpd/yourdomain.ru-error_log
CustomLog /var/log/httpd/yourdomain.ru-access_log common

We will now download the latest version of WordPress to the root directory and configure it just like any other regular installation. Enter the following command:

cd /var/www/html/yourdomain.tld && wget http://wordpress.org/latest.zip
unzip -qq latest.zip
mv wordpress/* .
rmdir wordpress
rm -f latest.zip

Set the legal owner of the root directory by running:

chown -R $(ps auxf | grep -v grep | grep http | tail -1 | awk {'print $1'}): /var/www/html/yourdomain.ru

Copy the sample config file:

cp -pv /var/www/html/yourdomain.ru/wp-config-sample.php /var/www/html/yourdomain.ru/wp-config.php

Now, at this point, we will create the required database and set the appropriate information in the configuration file. Log into MySQL as root user and run the following command:

# mysql -uroot -p

mysql> create database my_wordpress
mysql> grant all on my_wordpress.* to [email protected] identified by "sEcReT_my_pASsWoRd"
mysql> q

Let’s edit the file wp-config.phpusing any text editor:

# vim /var/www/html/wordpress/wp-config.php

/** The name of the database for WordPress */
define('DB_NAME', 'my_wordpress');

/ ** Имя пользователя базы данных MySQL * / 
определить ( 'DB_User', 'my_user');

/ ** MySQL пароль базы данных * / 
определить ( 'DB_PASSWORD', 'sEcReT_my_pASsWoRd');

Then visit your domain or IP address in a browser and set the required information to complete the installation:

Name of the site: yourdomain.ru

This step is very important for the future use of the multisite network. If you want sites to be created as subdomains (site1.yourdomain.ru, site2.yourdomain.ru, etc.), then fill in this field with the domain only (without the “www” in front of it, because you probably won’t like it if our site URLs are something like site1.www.yourdomain.ru).

If you want sites to be created as subdirectories, then you can also enter www.yourdomain.ru, then users’ websites will have URL like www.yourdomain.ru/site1)

After you fill in all the required fields, click the button Install

The WordPress installation is now complete. Before entering, we need to make one more change in the file wp-config.phpin order to allow a multisite option.

To do this, find this line => / * That’s all, stop editing! Happy blogging. * / <= in your file wp-config.php and just above it add the following lines:

# vim /var/www/html/yourdomain.ru/wp-config.php

/* My multisite config starts here */
define('WP_ALLOW_MULTISITE', true);

You can now log in with setup credentials and set up the multi-site function. After logging in, go

Tools >> Network configuration

Choose the preferred URL for your sites. It cannot be changed later.

Note: If you want to use the “subdomains” option, then you need a wildcard DNS record for your domain.

Then select Network header, enter your E-mail address and press the button Install

Follow the instructions and after you do backup of .htaccess and wp-config.php files, edit them as suggested and save the files.

Click on the link To come into log in again. That’s all. We have just installed Multisite WordPress on Centos VPS server.

To create a new site, go to My sites >> Network Admin >> Dashboard

How to install WordPress multisite on Centos with Apache

Sidebar