Blog

Wordpress Multisite Ssl

Multiple SSL Certificates for WordPress Multisite Domains in Plesk 11

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.”

adding-subscription

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.

open-basedir

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
/etc/init.d/httpd graceful

You have a fully hosted domain subscription in Plesk that is pointing to your WordPress Multisite installation! You are able to assign a unique IP and install an SSL certificate on this domain.

  1. Chip
    Chip10-04-2013

    Thanks for this walkthrough. I seem to be having a little trouble, however. Everything is setup per the instructions above, but the CSS isn’t working.

    Any thoughts?

    Thanks again for the walk-through!

  2. Robert Staddon
    Robert Staddon10-16-2013

    Hey Chip! I believe the issue you were experiencing was a result of running nginx on top of Apache. I just wrote a new article about how to change the nginx DocumentRoot in Plesk: http://abundantdesigns.com/2013/10/16/changing-the-nginx-document-root-on-plesk-11-5/

  3. Chip
    Chip10-17-2013

    Thanks Robert. I’ll give it a try and let you know the outcome.

  4. Chen
    Chen12-01-2013

    Hi, I am using Plesk 11.0.9.

    If I don’t create a new subscription in Plesk for the additionaldomain.com then how should I handle the DocumentRoot?

  5. Robert Staddon
    Robert Staddon12-06-2013

    @Chen, you do need to create a new subscription in Plesk for the additionaldomain.com in order for this approach to work.

  6. Vishnu
    Vishnu01-17-2014

    Our WordPress is set up on Windows 2008 Serves- how do I implement this process on that platform.

  7. Robert Staddon
    Robert Staddon01-17-2014

    I’m sorry, Vishnu, I do not know how you would do this on a Windows 2008 server.

  8. Nick Kuijpers
    Nick Kuijpers02-24-2014

    Hello,

    I have been searching a lot on the internet about this, i have made several vhost.conf but nothing worked out.

    I have found this solutions, in Plesk 11, you can use the Additional directives for http field at Websites and Domains -> Domain.com -> Web Server Settings so you dont need to SSH things etc.

    Paste this in the Additional directives for http.

    Hope it works out for someone else :).

    DocumentRoot /var/www/vhosts/domain.com/httpdocs
    SuexecUserGroup verhuiswebsite psacln

    AllowOverride All

    SetHandler fcgid-script
    Options +FollowSymLinks +ExecCGI

    SetHandler fcgid-script
    FCGIWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper .php
    Options +ExecCGI
    allow from all

    Options -Includes -ExecCGI

    https://www.niku-solutions.nl

Leave a Reply

Notify me of followup comments via e-mail. You can also subscribe without commenting.

    No Twitter Messages.