12 messages in ru.sysoev.nginxMass virtual hosting and global redirect
FromSent OnAttachments
NoSyncJun 15, 2009 6:30 am 
Igor SysoevJun 15, 2009 6:48 am 
NoSyncJun 15, 2009 8:23 am 
Igor SysoevJun 15, 2009 8:34 am 
NoSyncJun 15, 2009 9:22 am 
Igor SysoevJun 15, 2009 11:47 am 
NoSyncJun 16, 2009 6:43 am 
Igor SysoevJun 16, 2009 6:55 am 
NoSyncJun 16, 2009 7:31 am 
Igor SysoevJun 16, 2009 7:34 am 
NoSyncJun 16, 2009 8:06 am 
Edho P AriefJun 18, 2009 6:12 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Mass virtual hosting and global redirectActions...
From:NoSync (ngin@nginx.us)
Date:Jun 15, 2009 6:30:24 am
List:ru.sysoev.nginx

Hello everyone! I recently switched my main webserver (where I host clients'
websites) from apache to nginx and I wrote a custom generic configuration file
to handle everything in one place, so domains and subdomains are handled on the
fly by creating directories and subdirectories. Here's the relevant snippet:

server {

listen 80 default;

if ($host ~* ^(.*)\.(.*\..*)$) { set $sub $1; set $domain $2; }

server_name _; server_name_in_redirect off; root /var/www/vhosts/$domain/$sub; access_log /var/log/nginx/access.log combined; error_log /var/log/nginx/error.log error;

include /etc/nginx/conf/wordpress_params;

location / {

root /var/www/vhosts/$domain/$sub; index index.php index.html;

Everything works just fine as nginx is a great product ;-) Now, my only problem
lays in the fact I haven't been able to write a regexp to setup a global
redirect from, eg, domain.com to www.domain.com. Could anyone help me on this?

Thanks, Alessio

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