M
M
Michael2019-04-04 23:31:21
Nginx
Michael, 2019-04-04 23:31:21

How to make the server not respond to non-existent sites?

There are vps, five sites are spinning safely, they also
set the task to throw out one site via https, ok - done, the config removed nginx rebooted - I go to the site that I just deleted - and one of the 4 remaining ones is shown on you.
How to make nginx forget at all that there was a certain site and if it is not there, then do not open anything?
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SubGANs, 2019-04-04
@happy-cat

Make a stub, it will give 403, well, or you can show your page (the whole point is in default_server):

server {
  listen %ip%:80 default_server;
  return 403;
}

server {
  listen %ip%:443 ssl http2 default_server;
  ssl_certificate /etc/nginx/ssl/nginx.crt;
  ssl_certificate_key /etc/nginx/ssl/nginx.key;
  return 403;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question