码迷,mamicode.com
首页 > 其他好文 > 详细

nginx将泛解析的匹配域名绑定到子目录配置方法

时间:2015-06-09 11:17:41      阅读:118      评论:0      收藏:0      [点我收藏+]

标签:

server {
    listen        80;
    server_name   domain.com    *.domain.com;

 

    if ($host ~* ^([^\.]+)\.([^\.]+\.[^\.]+)$) {
        set $subdomain $1;
        set $domain $2;
    }

    location / {
        root    /home/wwwroot/$domain/$subdomain/;
        index   index.php index.html index.htm;
        #include /home/wwwroot/$domain/$subdomain/.ngx.htaccess;
    }

    error_page   500 502 503 504  /50x.html;

    location = /50x.html {
        root   html;
    }

    location ~ \.php$ {
        root           /home/wwwroot/$domain/$subdomain/;
        fastcgi_pass   127.0.0.1:9100;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
}

nginx将泛解析的匹配域名绑定到子目录配置方法

标签:

原文地址:http://www.cnblogs.com/yepanpan/p/4562859.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!