
Nginx泛解析的匹配域名绑定到子目录配置,有2种方法,推荐方法一
方法一:
- server{
- listen80;
- server_name~^(?<subdomain>.+).$;
- access_log/data/wwwlogs/_nginx.logcombined;
- indexindex.htmlindex.htmindex.php;
- root/home/wwwroot/linuxeye/$subdomain/;
- location~.php${
- fastcgi_passunix:/dev/shm/php-cgi.sock;
- fastcgi_indexindex.php;
- fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;
- includefastcgi_params;
- }
- location~.*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)${
- expires30d;
- }
- location~.*\.(js|css)?${
- expires7d;
- }
- }