Images and multisite in subfolder


#1

Hi,

I’ve just moved one of my sites on VPS with nginx, and images are not showing on my multi-site (subfolder). Nginx helper is installed, I generated map, included it in the mysite.com config file, but it’s rewrite engine for images still not working. Can you please advice?

  
map $uri $blogname{  
	~^(?/[^/]+/)files/(.*)	$blogpath ;  
}  

map $blogname $blogid{  
	default -999;  
    include /srv/www/mydomain.com/public_html/multisite-subfolder/wp-content/uploads/nginx-helper/map.conf ;  
}  

server {  
		listen 80;  
        server_name www.mydomain.com mydomain.com ;  

        access_log   /srv/www/mydomain.com/logs/access.log;  
        error_log    /srv/www/mydomain.com/logs/error.log debug;  

        root /srv/www/mydomain.com/public_html ;  
        index index.php;  

        if (!-e $request_filename) {  
                rewrite /wp-admin$ $scheme://$host$uri/ permanent;           
                rewrite ^/multisite-subfolder(/[^/]+)?(/wp-.*) /multisite-subfolder$2 last;        
                rewrite ^/multisite-subfolder(/[^/]+)?(/.*\.php)$ /multisite-subfolder$2 last;  
        }  

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

        location ~ \.php$ {  
                try_files $uri /multisite-subfolder/index.php;  
                include fastcgi_params;  
                fastcgi_pass 127.0.0.1:9000;  
        }  

        location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {  
                access_log off; log_not_found off; expires max;  
        }  

        location = /robots.txt { access_log off; log_not_found off; }  
        location ~ /\. { deny  all; access_log off; log_not_found off; }  
		  
	  
	location ^~ /blogs.dir {  
		internal;  
		alias /var/www/mydomain.com/public_html/multisite-subfolder/wp-content/blogs.dir ;  
		access_log off;	log_not_found off;	expires max;  
	}  
		  
	location ~ ^(/[^/]+/)?files/(?.+) {  
		try_files /multisite-subfolder/wp-content/blogs.dir/$blogid/files/$rt_file /wp-includes/ms-files.php?file=$rt_file ;  
		access_log off;	log_not_found off; expires max;  
	}	  
		  
		  
}  

Thanks in advance!


#2

Just to clarify, my setup is like this: domain.com - single wp installation domain.com/multisite - separate wp installation


#3

Any ideas?


#4

Most likely codes in parent sites are interfering with codes in multi-site.

Your setup is quite unorthodox. So you will need to tweak many references.

It's better you try debugging and see if image requests are reaching expected block - https://rtcamp.com/tutorials/nginx/debugging/


#5