<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div name="messageBodySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;">
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);">Dears</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51); min-height: 16px;"><br /></p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);">I have one wordpress multisite with subdomain being served by Nginx.</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51); min-height: 16px;"><br /></p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);">We have the main domain, lets call <a href="http://domain.com">domain.com</a>.</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);">We use custom domains for customer site lets say <a href="http://customerone.com">customerone.com</a>, <a href="http://customertwo.com">customertwo.com</a>… with correspondent subdomain on WP, as <a href="http://customerone.domain.com">customerone.domain.com</a>, <a href="http://customertwo.domain.com">customertwo.domain.com</a>.</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51); min-height: 16px;"><br /></p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);">Everything works fine with the configuration at the end of this email.</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51); min-height: 16px;"><br /></p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);">However, now we want to secure some custom domains for example <a href="https://customerone.com">https://customerone.com</a>.</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51); min-height: 16px;"><br /></p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);">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.</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51); min-height: 16px;"><br /></p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);">The problem is when I have more than one domain to secure.</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51); min-height: 16px;"><br /></p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);">I tried to insert more than one ssl_certificate on top to secure base domain (<a href="http://domain.com">domain.com</a>) and its subdomains. Doesn’t work.</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);">Then i search for some configuration to check domain and load the right certificate, couldn’t find.</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51); min-height: 16px;"><br /></p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);">Can someone help us to configure our server to work with non-ssl + ssl and Wordpress multisite subdomain ?</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51); min-height: 16px;"><br /></p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);">Thank you</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51); min-height: 16px;"><br /></p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);">map $http_host $blogid {</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> default -999;</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);">}</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51); min-height: 16px;"><br /></p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);">server {</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> server_name <a href="http://domain.com">domain.com</a> *.<a href="http://domain.com">domain.com</a> ;</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51); min-height: 16px;"><br /></p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> root /var/www/html/portal;</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> index index.php;</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51); min-height: 16px;"><br /></p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> access_log /var/log/nginx/domain.access.log combined;</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> error_log /var/log/nginx/domain.error.log;</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51); min-height: 16px;"><br /></p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> location / {</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> try_files $uri $uri/ /index.php?$args ;</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> }</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51); min-height: 16px;"><br /></p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> #WPMU Files</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> location ~ \.php$ {</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> autoindex on;</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> try_files $uri =404;</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> fastcgi_split_path_info ^(.+\.php)(/.+)$;</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51); min-height: 16px;"><br /></p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> # With php5-fpm:</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> #fastcgi_pass unix:/var/run/php5-fpm.sock;</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> fastcgi_pass unix:/run/php/php7.0-fpm.sock;</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> fastcgi_index index.php;</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> include fastcgi_params;</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> client_max_body_size 100M;</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> proxy_connect_timeout 180;</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> proxy_send_timeout 180;</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> proxy_read_timeout 180;</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> }</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> location ~ ^/files/(.*)$ {</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> try_files /wp-content/blogs.dir/$blogid/$uri /wp-includes/ms-files.php?file=$1 ;</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> access_log off; log_not_found off; expires max;</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> }</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51); min-height: 16px;"><br /></p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> #WPMU x-sendfile to avoid php readfile()</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> location ^~ /blogs.dir {</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> internal;</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> alias /home/portal/wp-content/blogs.dir;</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> access_log off; log_not_found off; expires max;</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> }</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51); min-height: 16px;"><br /></p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);"> #add some rules for static content expiry-headers here</p>
<p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(51, 51, 51);">}</p>
</div>
</body>
</html>