nginx 配置泛解析域名

@admin  June 15, 2018
 server {
    listen 80;
    server_name *.yangakw.cn;

    if ( $host ~* (\b(?!www\b)\w+)\.\w+\.\w+ ) {
            set $subdomain $1;
    }
    set $root /www....../$subdomain;
    if ( -d "/www....../$subdomain/public") {
            set $root /www....../$subdomain/public;
    }
    if ( -d "/www....../$subdomain/V1/public") {
            set $root /www....../$subdomain/V1/public;
    }
    index index.html index.htm index.php  default.php; 
    root $root;
    charset utf-8;
    location / {
       try_files $uri $uri/ /index.php$is_args$args;
    }
    fastcgi_param  PHP_VALUE  "open_basedir=$document_root:$document_root/../:/tmp/:/proc/";
    fastcgi_param  PHP_VALUE  "display_errors = On";

    include enable-php-pathinfo.conf; 
    access_log on;
 }

评论已关闭