This article is based on my earlier article, Three Ways so Setup WordPress Multisite Domain Mapping in Plesk 11, and assumes that you are using WordPress Multisite with the Domain Mapping plugin to host and maintain multiple websites from the same WordPress installation. Here I will explain in further detail the third method that you can use to set up an additional domain for WordPress Multisite in Plesk which I called “Domain with Hosting”.
A WordPress Multisite installation is created on a single subscription in Plesk, which can only be assigned a single IP address and a single SSL certificate. What if we want to have additional websites with separate IP addresses and/or SSL certificates powered by the same WordPress Multisite installation? Here is how I did this on my MediaTemple DV4 web server.
1. Create a subscription for the additional domain in Plesk
Personally, I like to add a new subscription for the additional domain via the Server Administration Panel. You do this by clicking Subscriptions > Add New Subscription. Select a service plan that includes hosting, such as “Default Domain.”
If you would like to assign a separate IP address to your additional domain, this is the place to do it. A unique IP will be required if you want to use an SSL certificate for your domain (unless you have SNI support on your server).
2. Point the DocumentRoot to your primary Multisite domain
We now want to point the DocumentRoot of this additional domain to our primary WordPress Multisite domain. We can do this by creating a file named vhost.conf in the additional domain’s conf directory. To avoid permissions errors, I usually do this via SSH as the root user. In addition to the DocumentRoot command, we can include a SuexecUserGroup command if we are running PHP as FastCGI. If the primary Multisite domain was primarydomain.com with the username of primarydomainuser, here is what the contents of the additional domain’s /conf/vhost.conf file would look like:
DocumentRoot /var/www/vhosts/primarydomain.com/httpdocs SuexecUserGroup primarydomainuser psacln <Directory '/var/www/vhosts/primarydomain.com/httpdocs'> AllowOverride All </Directory>
Because we’ll be using an SSL certificate, we also want to set the same DocumentRoot for all secure HTTPS traffic on the additional domain. We can do this by creating an identical file with the exact same contents named vhost_ssl.conf in the same conf directory.
UPDATE: If you are using nginx in Plesk 11.5, you will also need to specify the DocumentRoot for nginx.
3. Disable PHP open_basedir
By default, PHP enables the open_basedir command to limit the files that can be opened by PHP. If the file is outside the specified directories, PHP scripts will refuse to open it. However, because we have switched the DocumentRoot for this additional domain to point to our primary Multisite domain, we need to either update this value or disable it. We can set the open_basedir setting to “none” by selecting our subscription, clicking the “Customize” button, and selecting the “PHP Settings” tab.
4. Enable PHP to run as FastCGI on the new DocumentRoot
After setting the DocumentRoot to point to the primary Multisite domain, for some reason PHP wouldn’t properly execute on those files. Visiting the site in a web browser would result in downloading the PHP files instead of running them and generating the web page. Adding the following to the vhost.conf and vhost_ssl.conf files that you just created in your conf directory will force PHP to run as FastCGI on that folder.
<Directory /var/www/vhosts/primarydomain.com/httpdocs> <IfModule mod_fcgid.c> <Files ~ (\.fcgi)> SetHandler fcgid-script Options +FollowSymLinks +ExecCGI </Files> </IfModule> <IfModule mod_fcgid.c> <Files ~ (\.php)> SetHandler fcgid-script FCGIWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper .php Options +ExecCGI allow from all </Files> </IfModule> Options -Includes -ExecCGI </Directory>
5. Reload the domain configuration
After creating or modifying either vhost.conf or vhost_ssl.conf files in the domain’s conf directory, we run the following commands in SSH to reload the configuration for the additional domain (additionaldomain.com) and restart Apache:
/usr/local/psa/admin/bin/httpdmng --reconfigure-domain additionaldomain.com