Multisite in subfolder


#1

Hi,

I posted a comment few days ago, but couldn’t solve it.

I installed nginx+php5-fpm on ubuntu, and I have main.com domain with multisite in subfolder main.com/multisite.
Your nginx helper plugin is installed on both, but permalinks are not working on multisite, and also the demo sites (main.com/multisite/demo1, main.com/multisite/demo2 etc). I always get 404 from my main site.

This is my nginx.conf: http://pastebin.com/3wSpcZBE,
and this is my sites-enabled file: http://pastebin.com/D5xinqdH.

After visiting few times some of demos (main.com/multisite/demo1)
I got nothing in main.com.error.log, or error.log from var/log/nginx.

What could be the issue?


#2

Sorry for delayed reply.

Looks like you have got caching involved - http://pastebin.com/D5xinqdH (W3TC).

For multisite in subdirectory, try this config instead - http://rtcamp.com/wordpress-nginx/tutorials/multisite/subdirectories/in-a-subdirectory/

If you get it working, we can add caching support later on.

Try config at above link and let us know if it works.


#3

Figured it out… Problem was in fastcgi pass.

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

        }  

This is how it’s working. Thank you a lot!


#4

Glad to know that. :slight_smile:

I am marking this issue resolved. Feel free to create new support topic, if need arises.


#5

[moderatio note: threads are merged]

Hi,

since the thread is closed, and I was wrong by saying it’s all working, you might want to link this solution, or even update a post (there’s a fair chance that main site is wp too).

With previous nginx configuration my multisite in subdirectory was working, but permalinks on the main site didn’t. I just noticed that, and I wanted to post a solution here:

  
server {  
        server_name www.main.com main.com;  

        access_log   /var/log/nginx/main.com.access.log;  
        error_log    /var/log/nginx/main.com.error.log debug;  

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

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

        location / {  
                try_files $uri $uri/ /index.php?$args ;  
        }  
          
        # Remember to change multisite to your subdirectory name  
        location /multisite {  
                try_files $uri $uri/ /multisite/index.php?$args ;  
        }  

        location ~ \.php$ {  
                try_files $uri /multisite/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|d$  
                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; }  
}  

#6

@wp_query

Merged thread. Thanks for sharing your config. :slight_smile:


#7