More subdomain mapping (dynamic 'root'?)

Frank Louwers frank at openminds.be
Fri Jul 3 13:36:24 MSD 2009


On 01 Jul 2009, at 12:23, miradev wrote:

> I want to be able to map submains and urls to determined locations  
> on disk, if they exist.
>
> The URL structure is something like: http://.admin.domain.com/
>
> Where  would letters, numbers and underscores , and  is a domain  
> name (e.g.  http://cnn.admin.domain.com/www.cnnminiblog.com)
>

This is what we do for a customer: this allows them to create new  
domains/projects just by making a new directory. With passenger and  
php-fpm and this setup, he doesn't need to restart/reload *anything*  
to start a new website.

server {
         listen       80;
         server_name  _;
         server_name_in_redirect off;
         passenger_enabled on;
         passenger_use_global_queue on;
         root   /home/customer/sites/$host/public;

         if (!-d $document_root) {
                 #site not (yet) configureerd. Serve default
                 rewrite (.*) http://default.customer.tld/;
         }

         location / {
           passenger_enabled on;
                 index index.html index.htm index.php;
         }
         location ~ .php$ {
                 fastcgi_pass 127.0.0.1:9000;
                 fastcgi_index index.php;
                 include fastcgi_params;
         }
}

Regards,

Frank
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20090703/752bbd78/attachment.html>


More information about the nginx mailing list