D
D
ddddd tttt2020-08-15 23:20:09
Nginx
ddddd tttt, 2020-08-15 23:20:09

Why does the subdomain overlap the main domain?

server {
  charset utf-8;
    client_max_body_size 128M;

     listen 443 ssl;
     listen [::]:443 ssl;

    server_name admin.example.ru;
   root /var/www/admin.site/web;
  index index.php;

  location / {
    try_files $uri $uri/ /index.php$is_args$args;
  }


  location ~ \.php$ {
    include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      fastcgi_pass unix:/run/php/php7.4-fpm.sock;
      expires off;
        try_files $uri =404;
  }

    location ~ ^/assets/.*\.php$ {
        deny all;
    }

    ssl_certificate /etc/letsencrypt/live/admin.example.ru/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/admin.example.ru/privkey.pem; # managed by Certbot
}


server {

  charset utf-8;
    client_max_body_size 128M;
    
    listen [::]:443 ssl; # managed by Certbot
    listen 443 ssl; # managed by Certbot

    server_name www.example.ru example.ru;
  root /var/www/html/web;
  index index.php;

  location / {
    try_files $uri $uri/ /index.php$is_args$args;
  }


  location ~ \.php$ {
    include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      fastcgi_pass unix:/run/php/php7.4-fpm.sock;
      expires off;
        try_files $uri =404;
  }

    ssl_certificate /etc/letsencrypt/live/example.ru/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/example.ru/privkey.pem; # managed by Certbot

}

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

  server_name www.example.ru example.ru;
  rewrite ^ https://example.ru$request_uri? permanent;
    return 404; # managed by Certbot
}


The admin.example.ru subdomain overlaps exampl.ru for some reason. There is always a redirect to admin.example.ru.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vader666, 2020-08-20
@vader666

I assume that the names of the configuration files begin admin.example.com and example.com . Rename them to 01_example.com.conf and 02_admin.example.com.conf .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question