nginx wordpress multiple subdirectories

I have an nginx server with php5-fpm hosting 3 frameworks. 1 PHP framework, 2 wordpress.

All live in the /var/www folder, so for this purpose

Read More
  • /var/www/website – PHP framework
  • /var/www/blog – WordPress
  • /var/www/blog2 WordPress

When trying to access the blogs, all of the assets(css, images, etc…) don’t work, they throw a 404. I can’t access the wp-admin page as well since it results in an infinite redirect.

Here’s the relevant information in the Nginx config file.

server{
    root /var/www/website;
    index index.html index.htm index.php;

    set $php_root /var/www/website;

    location /blog {
        set $php_root /var/www/blog;

        if(!-e $request_filename){
            rewrite ^(.+)$ /index.php last;
            break;
        }
    }

    location /blog2 {
        set $php_root /var/www/blog2;

        if(!-e $request_filename){
            rewrite ^(.+)$ /index.php last;
            break;
        }
    }

    location / {
        if(!-e $request_filename){
            rewrite ^(.+)$ /index.php last;
            break;
        }
    }

    location ~ .php$ {
        fastcgi_param  SCRIPT_FILENAME  $php_root$fastcgi_script_name;
    }

}

Any and all help is appreciated.

Related posts

Leave a Reply