Nginx域名泛解析
server {
listen 80;
server_name *.test.xxxxxxxx.com;
if ($host ~* ^([^\.]+)\.([^\.]+)\.([^\.]+\.[^\.]+)$) {
set $mythirddomain $1;
set $mysubdomain $2;
set $mydomain $3;
}
index index.html index.htm index.php;
root /www/test.xxxxxxxx.com/$mythirddomain;
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;
}
}