Welcome! Log In Create A New Profile

Advanced

Wordpress multisite + SSL

Giulio Loffreda
April 06, 2018 01:42PM
Dears

I have one wordpress multisite with subdomain being served by Nginx.

We have the main domain, lets call domain.com.
We use custom domains for customer site lets say customerone.com, customertwo.com… with correspondent subdomain on WP, as customerone.domain.com, customertwo.domain.com.

Everything works fine with the configuration at the end of this email.

However, now we want to secure some custom domains for example https://customerone.com.

For one secured domain, it works fine. I can use some plugin to force HTTPS on WP and insert certificate on top of nginx configuration.

The problem is when I have more than one domain to secure.

I tried to insert more than one ssl_certificate on top to secure base domain (domain.com) and its subdomains. Doesn’t work.
Then i search for some configuration to check domain and load the right certificate, couldn’t find.

Can someone help us to configure our server to work with non-ssl + ssl and Wordpress multisite subdomain ?

Thank you

map $http_host $blogid {
    default       -999;
}

server {
    server_name domain.com *.domain.com ;

    root /var/www/html/portal;
    index index.php;

    access_log /var/log/nginx/domain.access.log combined;
    error_log /var/log/nginx/domain.error.log;

    location / {
        try_files $uri $uri/ /index.php?$args ;
    }

    #WPMU Files
        location ~ \.php$ {
                autoindex on;
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
               # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini

                # With php5-fpm:
                #fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_pass unix:/run/php/php7.0-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                client_max_body_size       100M;
                proxy_connect_timeout      180;
                proxy_send_timeout         180;
                proxy_read_timeout         180;
        }
        location ~ ^/files/(.*)$ {
                try_files /wp-content/blogs.dir/$blogid/$uri /wp-includes/ms-files.php?file=$1 ;
                access_log off; log_not_found off;      expires max;
        }

    #WPMU x-sendfile to avoid php readfile()
    location ^~ /blogs.dir {
        internal;
        alias /home/portal/wp-content/blogs.dir;
        access_log off;     log_not_found off;      expires max;
    }

    #add some rules for static content expiry-headers here
}
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Wordpress multisite + SSL

Giulio Loffreda April 06, 2018 01:42PM

Re: Wordpress multisite + SSL

basti April 06, 2018 01:52PM

Re: Wordpress multisite + SSL

Giulio Loffreda April 06, 2018 02:22PM

Re: Wordpress multisite + SSL

basti April 06, 2018 02:58PM

Re: Wordpress multisite + SSL

Giulio Loffreda April 06, 2018 03:16PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 176
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready