nginx二级域名配置到文件夹

user root;
worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
sendfile        on;
    keepalive_timeout  65;
        upstream nifd.cn {
                server 127.0.0.1:8081 weight=1;
                #server 123.57.254.32:5200 weight=1;
        }
    server {
        listen       80;
        server_name  *.nifd.cn;
        if ( $host ~* (.*)\.(.*)\.(.*) )
        {
                set $domain $1;
        }

        location / {
                proxy_pass http://nifd.cn/$domain/$request_uri;
                index index.html index.php;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
   }
}

以上是配置文件。其中request_uri可以

你可能感兴趣的:(nginx二级域名配置到文件夹)