Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

OK So I've set up a multisite wordpress network on my nginx vps but I'm having trouble getting the subdirectory sites working (it is a subdirectory only network - not subdomain). I've looked for a multisite-specific config file but I get 403 forbidden error when visiting a sub-site. The main site works fine.

Here is my config:

server {
        ##DM - uncomment following line for domain mapping  
        #listen 80 default_server;
    server_name mysite.com www.mysite.com ;
    ##DM - uncomment following line for domain mapping
    #server_name_in_redirect off;

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

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

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

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

    location ~ \.php$ {
        try_files $uri /index.php?args;
        include fastcgi_params;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
    }

    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; }
}

Any ideas?

share|improve this question
    
codex.wordpress.org/Nginx –  Michael Hampton Apr 29 '13 at 21:02
    
I'm a bit confused by that as my config file is a file called mysite.com which resides in etc/nginx/sites-available/mysite.com/. (mysite.com being replaced with the actual url). That link has many config files and I have no idea where they're all meant to be. If someone could point me to a nginx config guide that would be helpful –  harryg Apr 29 '13 at 21:18
    
I just did point you to an nginx config guide! –  Michael Hampton Apr 29 '13 at 21:19
    
Yes but that talks about having multiple config files for the server. I just want to find out the problem with my single config file for this site. I presume it is the rewrite rules but I am not experienced enough to solve it –  harryg Apr 29 '13 at 21:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.