A
A
Alexander2018-07-26 16:01:59
Nginx
Alexander, 2018-07-26 16:01:59

Nginx and other domains on my IP, how to deny them access?

Hello!
There is a small problem: some comrades put their domains on my IP address and, accordingly, when visiting their site, mine is shown.
The site itself with SSL connected (i.e. when you go to their domains, the certificate is shown as invalid, but you can get to the site). How can I configure nginx so that domains not specified in the configs are not processed by it over a secure SSL channel? I figured it out without ssl, but I can't with it.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Alexander, 2018-07-26
@leaderDR

Solved the problem, it turned out to be easier than I thought. All you had to do was set up the default config. I will leave a link to a branch with general solutions on this issue, maybe it will be useful to someone) https://stackoverflow.com/questions/9824328/why-is...

server {
    listen 80 default_server;
    listen 443 ssl http2 default_server;
    server_name _;
    ssl_certificate <path to cert>
    ssl_certificate_key <path to key>
    return 444;
}

A
Andrey, 2018-07-26
@VladimirAndreev

remove default - host.
well, or hang a cat on it.

S
Sanes, 2018-07-26
@Sanes

https://firstwiki.ru/index.php/%D0%A1%D0%B0%D0%B9%...
I hope the idea is clear. Do it on hostname for example.
Common mistake to ignore hostname and dns

L
lexa buskov, 2018-07-27
@lexaty

it's better to put a redirect on your site
I think extra traffic won't hurt you And the client will see the address of your domain site

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question