Welcome! Log In Create A New Profile


Re: More subdomain mapping (dynamic 'root'?)

July 02, 2009 11:29AM
No replies as yet.

This is what I have come up with so, but I'm not sure I am passing on the correct values to fcgi.
And I would like the log file locations to be a little dynamic.

server {
listen localhost:80; # your server's public IP address
server_name .admin.domain.com;

access_log /var/log/nginx/wordpress/admin/generic-access.log;
error_log /var/log/nginx/wordpress/admin/generic-error.log;

set $client $host;
if ($client ~ "^([a-z0-9]*).admin.domain.com"){
set $client $1;

location ~ ^/([^/]*)/?(.*) {
set $domain $1;
set $myuri $2;
root /var/www/wordpress/$client/admin/$domain/html;
index index.php index.html index.htm;
if (-f $request_filename) {
expires 30d;

try_files $domain/$myuri $domain/$myuri/ /$domain/index.php?q=$myuri&$args;

location ~ \.php$ {
fastcgi_pass localhost:57093; # port where FastCGI processes were spawned
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/wordpress/$client/admin/$domain/html$fastcgi_script_name; # same path as above

fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;

fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;

fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;

# required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;

Any helpful comments or musings much appreciated.
Subject Author Posted

More subdomain mapping (dynamic 'root'?)

miradev July 01, 2009 06:23AM

Re: More subdomain mapping (dynamic 'root'?)

miradev July 02, 2009 11:29AM

Re: More subdomain mapping (dynamic 'root'?)

Frank Louwers July 03, 2009 05:36AM

Re: More subdomain mapping (dynamic 'root'?)

miradev July 03, 2009 06:42AM

Re: More subdomain mapping (dynamic 'root'?)

Frank Louwers July 03, 2009 08:56AM

Re: More subdomain mapping (dynamic 'root'?)

miradev July 03, 2009 10:19AM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 96
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