Dynamic Subdomain Configuration

justin nginx-forum at nginx.us
Mon Feb 20 19:28:54 UTC 2012


Hello,

We provide a subdomain for each user, for example:
 
     paul.ourdomain.com
     jay.ourdomain.com
     bob.ourdomain.com
     xxxxx.ourdomain.com

Currently, I am doing this manually by adding another config in
/etc/nginx/conf.d for each subdomain. A typical conf looks like:

server {
  listen 80;

  server_name paul.ourdomain.com;

  root /srv/www/users/paul/wp;

  index index.php;

  access_log /var/log/nginx/vhosts/paul.access.log;
  error_log /var/log/nginx/vhosts/paul.error.log;

  include /etc/nginx/excludes.conf;
  include /etc/nginx/wordpress.conf;
  include /etc/nginx/expires.conf;
}

Is there I way I can abstract this, and prevent creating a configuration
for each subdomain? I was reading something about map, but don't fully
understand it.

Thanks.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,222733,222733#msg-222733



More information about the nginx mailing list