server {
listen 80;
server_name ~^(?<subdomain>.+)\.youwebname\.com$;
index index.html index.htm index.php;
root /wwwroot/$subdomain;
error_page 404 = /404.html;
location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
access_log /alidata/log/nginx/access/hn.log;
}
原文地址:http://wangxiaoyong.blog.51cto.com/2289427/1681468