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的站点。

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

《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

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