Welcome! Log In Create A New Profile

Advanced

Multiple Wordpress subdurectories

Posted by miradev 
Multiple Wordpress subdurectories
October 09, 2009 04:24AM
I am revisiting my multi setup.

The idea is to map [code]
http://<CLIENT>.wp.mysite.net/<DOMAIN>/
[/code]
to [code]
/var/www/wordpress/<CLIENT>/devel/<DOMAIN>/
[/code]


Here is my current config:

[code]
server {
listen 10.0.0.1:80;
server_name .wp.mysite.net;

error_log /var/log/nginx/wordpress/devel/generic-error.log;
error_page 404 /no_such_event.html;

set $client $host;
if ($client ~ "^([a-z0-9]*).wp.mysite.net"){
set $client $1;
}
root /var/www/wordpress/$client/devel;
index index.php index.html index.htm;
access_log /var/log/nginx/wordpress/devel/$client/generic-access.log;

if (!-d $document_root) {
rewrite (.*) /no_such_client.html last;
}

location = /no_such_client.html {
internal;
root /var/www/wordpress/vanilla/devel_pages;
}
location = /no_such_event.html {
internal;
root /var/www/wordpress/vanilla/devel_pages;
}

if ( $uri !~* \.(php|css|js|jpg|jpeg|gif|png|swf|htm) ) {
rewrite /([^/]+)/?(.*)$ /$1/index.php?q=$2&$args last;
}

location ~ ^/([^/]+)/?(.*)\.php($|/) {
root /var/www/wordpress/$client/devel/$1;
set $mydom $1;
set $script $2;
set $path_info "";

if ($uri ~ "^(.+\.php)(/.+)") {
set $script $1;
set $path_info $2;
}

include wordpress/fcgi_generic_params.conf;
}
}
[/code]

This works to an acceptable degree, as it is not a production environment.

However, it is missing the traditional [i]try_files[/i], and auto-execution of index files in subdomains does not work. EG: [i]http://client1.wp.mysite.net/www.event1.com/wp-admin[/i] does not rewrite to [i]http://client1.wp.mysite.net/www.event1.com/wp-admin/index.php[/i].

Also, some functionality does not work, probably due to not being caught in my list of exclusions ([i]$uri !~* \.(php|css|js|jpg|jpeg|gif|png|swf|htm)[/i]). But I would like to avoid needing this, ultimately.

All feedback and criticism gladly absorbed :)
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 83
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready