Centos7 Nginx二级域名对应不同目录
2019-11-11 作者  Winter    服务器    阅读量1041    评论量0

server {

        listen       80 default_server;

        listen       [::]:80 default_server;

        listen       443 ssl;

        server_name  ~^(.*?).mysite.com$;  #注:~ 不能省

        ssl_certificate    /usr/share/nginx/html/mysite/ca/mysite.cer;

        ssl_certificate_key /usr/share/nginx/html/mysite/ca/mysite.key;

        set $sub $1;

        ###二级域名,wap.mysite.com

        if ($sub ~* 'wap') {

             rewrite ^/$  /Wap/UserLogin/login last;

        }

        root         /usr/share/nginx/html/mysite;

        index index.php index.html index.htm;

        # Load configuration files for the default server block.

        include /etc/nginx/default.d/*.conf;


        location / {

            if (!-e $request_filename) {

                rewrite  ^(.*)$  /index.php?s=/$1  last;

                break;

            }

        }

        error_log /usr/share/nginx/logs/error.log error;


        location ~ /\.ht {

           deny  all;

        }


        location ~ .+\.php($|/) {

          fastcgi_pass 127.0.0.1:9000;

          fastcgi_index index.php;


           fastcgi_split_path_info ^(.+\.php)(/.*)$;

           fastcgi_param PATH_INFO $fastcgi_path_info;

           fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

           include fastcgi.conf;

        }

}


上一篇:Nginx下Php站点发布
下一篇:TP5用cron实现linux定时任务

0条评论
热门文章
热评文章
精品课程

¥小额赞助

联系我们

邮箱:chennengit@163.com

手机:13455295173(微信)

QQ:376926761