Answer the question
In order to leave comments, you need to log in
Nginx and foreign domains
Hello!
There is the following problem: some comrades put their domains on our ip address and, accordingly, when visiting their site, our site is shown.
How can I configure nginx so that domains not specified in the configs are not processed by it?
Answer the question
In order to leave comments, you need to log in
I set mine up like this:
server {
server_name_;
return 444;
}
server {
listen something there default;
return 404;
or (if you want to leave the traffic)
rewrite ^/(.*) where you need to go/ $1 permanent;
}
you can specify the site (directory) by default. one of the servers in the config - specify the ip without specifying the domain
nginx.org/en/docs/http/request_processing.html
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question