N
N
Nikita Kudrin2021-09-28 20:00:00
Nginx
Nikita Kudrin, 2021-09-28 20:00:00

How to disable requests for a subdomain?

I have this configuration

spoiler
server {
        listen 80;
        server_name hepka.click;
        return 301 https://$host$request_uri;
}

server {
        listen 443 ssl http2;
    	listen [::]:443 ssl http2;
    	server_name hepka.click;
        ssl on;
        ssl_certificate /etc/letsencrypt/live/hepka.click-0001/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/hepka.click-0001/privkey.pem;
        
        access_log /var/log/nginx/hclick.access.log;
        error_log /var/log/nginx/hclick.error.log;
        
        location /  {
            proxy_set_header X-Forwarder-For $proxy_add_x_forwarded_for;
       	 proxy_set_header Host $http_host;
   		 proxy_set_header X-NginX-Proxy true;
   		 proxy_pass http://127.0.0.1:1337;
   	     proxy_redirect off;
        }
}

The problem is that along with hepka.click, its subdomains are also processed. How to prevent it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dostoevskiy54, 2021-09-28
@HepkaPlay

Most likely your nginx config was taken as default. Create somewhere else 1 config and write

server {
        listen 80 default_server;
        server_name _;
        return 403;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question