Nginx Multisite and WordPress Block Themes

, ,
CodeMilitant Solutions for Linux Nginx Python PHP Bash MariaDB

When setting up Nginx to run with WordPress Multisite, it’s vital that each sub-domain have it’s own Nginx configuration:

map $http_host $blogid {
    default			0;			1;
    ### the numbers represent the blod id and the fqdn of the domain pointed at this multisite instance		2;	3;
    #	3;
    #	4;

Then each subdomain for the Multisite should be:

server {
    listen 443 ssl;

    include global/wp_multisite.conf;
    include global/http_headers.conf;
    include ssl/ssl_localhost.conf;
    include global/compression.conf;

    location / {
        proxy_set_header Host $host;
	proxy_set_header X-Real-IP $remote_addr;
	proxy_set_header  X-Forwarded-For $remote_addr;
	proxy_set_header  X-Forwarded-Host $host;
	proxy_set_header X-Forwarded-Proto $scheme;
        proxy_pass http://foodsites;
    access_log  /var/log/nginx/example.access.log main;
    error_log  /var/log/nginx/example.error.log error;

Failure to add the Nginx configs above will result in custom CSS and functions.php failing to load for each designated subsite. The CSS and custom functions.php will load from the first previous subsite configured in Nginx.