VPS CentOS nginx 环境 想搭建 2 个站点但是只有第一个站点可以打开,第二个一直错误

  ::首先在nginx.conf的底部添加了include /etc/nginx/conf.d/.conf;
然后在conf.d的目录下有2个文件分别创的是default.conf (第一个站点) 和 try.conf(第二个站点)
try.conf内容
server {
listen 80;
server_name www.karpeng.top;
server_name karpeng.top;
set $root_path '/var/www/html/thinkphp/public';
root $root_path;
index index.php index.html index.htm;
try_files $uri $uri/ @rewrite;
location @rewrite {
rewrite ^/(.
)$ /index.php?_url=/$1;
}
location ~ .php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index /index.php;
include /etc/nginx/fastcgi_params;
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
root $root_path;
}
location ~ /.ht {
deny all;
}
}

default.conf 内容
server {
listen 80;
server_name jijincaigang.win;
set $root_path '/var/www/html/laravel/public';
root $root_path;
index index.php index.html index.htm;
try_files $uri $uri/ @rewrite;
location @rewrite {
rewrite ^/(.)$ /index.php?_url=/$1;
}
location ~ .php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index /index.php;
include /etc/nginx/fastcgi_params;
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~
^/(css|img|js|flv|swf|download)/(.+)$ {
root $root_path;
}
location ~ /.ht {
deny all;
}
}

目录没问题,但是只有default中的站点能打开,如果把try中的root 目录改成和default中一样,就能打开,但是打开的是default的站点。

请问大神,我这里是哪里出错了!

《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
《L04 微信小程序从零到发布》
从小程序个人账户申请开始,带你一步步进行开发一个微信小程序,直到提交微信控制台上线发布。
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!