How to setup WordPress Multi-Site on CyberPanel

How to setup WordPress Multi-Site on CyberPanel

A multi-site setup for WordPress enables the end-user to create multiple WordPress sites from the WordPress dashboard. Each site with-in a WordPress network acts as a separate WordPress installation and can be managed from a single dashboard.

This feature is provided by WordPress to ensure that its users can easily create a network of sites without digging too much into server-side problems.

In this article, we will describe how to setup WordPress multi-site network using CyberPanel and then issue Wildcard SSL for multi-site operations.

Table of Contents:

  1. Setup Catch all vHost
  2. Things to do before enabling Multi-Site on WordPress
  3. Configuring WordPress to allow Multi-Site
  4. Create/Install a Multi-site Network
  5. Configuration of Multi-site setup
  6. Create a new site on Network
  7. Setup wildcard SSL on multi-site

1. Setup catch All vHost:

The first thing to do before setting up multi-site is the setup of Catch all vHost. Catch all vHost is the must thing to do before enabling the multi-site configuration in WordPress. A multi-site setup is not possible without the setup of Catch all vHost.

The method for catch-all vHost is different for LiteSpeed Ent and OpenLitespeed.

Setup catch all vHost for LiteSpeed Ent:

Open your vHost file from the website manager and edit this line

ServerAlias www.abc.com
wildcard SSL

Change this to

ServerAlias *.abc.com

Setup Catch all vHost for OpenLiteSpeed:

The setup for OpenLightSpeed is very different from LightSpeed. Follow the steps to do this:

Open “/usr/local/lsws/conf/httpd_config.conf” via command line or using an SFTP software.

image 25

Once you open this file find the Listener Default portion for port 80 (HTTP). It look like:

listener Default{
map example.com example.com
address *:80
secure 0

Now if you want to set up catch-all vHost for example.com, change the map line to following:

listener Default {
map example.com example.com, *.example.com
address *:80
secure 0

After this portion similarly you have to edit the listener SSL by default it looks like:

listener SSL {
map example.com example.com
address *:443
secure 1
keyFile /etc/letsencrypt/live/example.com/privkey.pem
certFile /etc/letsencrypt/live/example.com/fullchain.pem
enableStapling 1
ocspRespMaxAge 86400

Edit this file add *.example.com on the last of this portion:

listener SSL {
map example.com example.com,*.example.com
address *:443
secure 1
keyFile /etc/letsencrypt/live/example.com/privkey.pem
certFile /etc/letsencrypt/live/example.com/fullchain.pem
enableSpdy 15
enableStapling 1
ocspRespMaxAge 86400

vHost Configuration for OpenLiteSpeed:

After editing httpd_config.conf file (/usr/local/lsws/conf/httpd_config.conf) you need to open vHost option from Website Manager and edit vHost.

Default vhAliases

vhAliases www.$VH_NAME
image 26

Edit vhAliases to:

vhAliases *.$VH_NAME
image 27

2. Things to do before enabling Multi-site on WordPress

There are a few things you need to do before enabling and using Multi-Site on WordPress. Here are some key points:

Backup your full single website:

Always make a backup of your whole site (files and databases) before creating a network. this is an important step so you don’t lose your data and files.

Pretty Permalinks

Check and verify the pretty permalinks work on your single WordPress site.

like: https://wordpress.org/?p=1

image 11

Deactivate Plugins

Deactivate all WordPress plugin before the creation of the network. And activate again after creation.

Go to Plugins->Active and then click on the deactivate button present below every plugin name as shown below in the picture.

image 12

3. Configure Allow multi-site setup

To allow the multi-site setup or network setup you have to check your wp-config.php file on your file manager of the website and add this code to that file.

define( 'WP_ALLOW_MULTISITE', true );

wp-config.php file is present in public_html folder of site.

image 13

4. Create/Install a multi-site Network

After enabling multi-site mode from wp-config.php file now you can see a new option under the tools tab in wp-admin.

Before enabling multi-site network from wp-config.php file.

image 14

After enabling the mode.

Multisite On WordPress

Now go to this new option Network setup in the tool menu. You can see this screen.

image 16

In this screen the first note is for the pretty permalink.

You can select the option. Your sites will be subdomains or subdirectories in the network.

Sub Domian:

subdomain is a domain that is part of a larger domain. A domain-based network in which on-demand sites use subdomains. Like if our domain is “www.abc.com” then “site1.abc.com” or “site2.abc.com” are your subdomains.

Sub Directories:

Note: This does not require setting up catch-all vhost.

A path-based network in which on-demand sites use paths. Like “www.abc.com/site1” or “www.abc.com/site1” are subdirectories.

Use can set network titles according to your choice also provide the network admin email. and after that click on the install, button to process.

5. Configuration of Multi-site setup

Once the network installation is complete. Setup shows a screen which has code for the configuration of wp-config.php and .htaccess files. Copy these lines of code and paste into wp-config.php and .htaccess files accordingly.

image 17

Copy the lines of code and add these to the wp-config.php and replace the second lines of code and replace all these with .htaccess file present in the public_html folder.

After editing these files must log in again to the wp-admin. So you can see the changes on the dashboard. You can see these two new options on your dashboard.

image 18

6. Create new sites on Network

To create new sites Go to the My sites->Network admin->Dashboard option from the top bar of wp-admin.

image 19

When you visit this option you can see a different type of dashboard on your screen.

image 21

To create a new site visit Sites->add new option.

image 20

After clicking the add new button. A screen appears that requires information about your subdomain or subdirectory. As I selected subdirectory its look like:

image 22

In the case of sub domain it look little different.

Once you click the add site button you can see the Dashboard and edit site button on the top of the page.

image 23

You can access the site Dashboard or edit newly create site from here.

7. Setup wildcard SSL on multisite.

For a multi-site setup, we can use the wildcard SSL. Once you create a wild card SSL you have no need to create SSL for every sub domain as WildCard SSL will cover all subdomains.

Create wildcard SSL

Create a wild card SSL for your network using this command on the server terminal.

/root/.acme.sh/acme.sh --issue -d <youdomain.com> -d '*.<youdomain.com>' --dns dns_cf --cert-file /etc/letsencrypt/live/<youdomain.com>/cert.pem --key-file /etc/letsencrypt/live/<youdomain.com>/privkey.pem --fullchain-file /etc/letsencrypt/live/<youdomain.com>/fullchain.pem

CloudFlare File configuration

After creating that wildcard ssl its time to edit information in dns_cf.sh file present in “/root/.acme.sh/dnsapi” directory.

Replace the CF_Key and CF_Email by your key and email. Also, remove # Singh to active them.

CF_Email="[email protected]"

You can also Use CF_token for this process.

Fellow this guide to check CF_Key or generate CF_token.



Follow US on Facebook / Twitter  for update.

Tags: , , , , , ,

Leave a Reply

Your email address will not be published.