无法找出 ubuntu 16.X 服务器上第二个子域的 nginx 配置文件

无法找出 ubuntu 16.X 服务器上第二个子域的 nginx 配置文件

我是服务器新手nginx

我需要在 ubuntu 16.X 服务器中运行 3 个基于域和子域的不同代码库。

domain.com
sub1.domain.com 
sub2.domain.com 

在我的/etc/nginx/sites-available文件夹中,我创建了 3 个文件

domain.conf
domain1.conf
domain2.conf 

以下是每个文件中的代码

域名配置文件

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    server_name domain.com;
    root /var/www/html;

    index index.html;
    location / {
  if (!-e $request_filename){
rewrite ^/([^\.]+)$ /$1.html break;
 }
}

listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

} 

域1.conf

server {
    listen 80;
    listen [::]:80;

    server_name sub1.domain.com;
    root /var/www/app/angular_app/dist;

    index index.html;
    location / {
            try_files $uri $uri/ /index.html;
    }
}

域2.conf

 server {
    listen 80;
    listen [::]:80;

    server_name sub2.domain.com;
    root /var/www/supportapp;

    index index.html;
    location / {
            try_files $uri $uri/ /index.html;
    }
}

domain.com并且与sub1.domain.com完美配合httphttps

但是当我输入时http://sub2.domain.com,它会带我去domain.com index.html归档,当我输入时https://sub2.domain.com,它会带我去sub1.domain.com index.html归档

nginx -t没有显示任何错误。

这可能是什么问题?我该如何解决?

相关内容