Answer the question
In order to leave comments, you need to log in
How to block HTTPS requests to an IP address in Nginx?
Good day.
I want to make several sites on one physical server. I am using Nginx. At the same time, I do not want any of the sites to be opened by the IP address of the site or by a domain not configured in Nginx.
For HTTP, I made a similar config:
server {
listen 80 default_server;
location / {
deny all;
}
}
server {
listen 80;
server_name example.com;
location / {
# тут настройки
}
}
server {
listen 80 default_server;
listen 443 ssl default_server;
location / {
deny all;
}
}
server {
listen 443 ssl;
server_name example.com;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;
location / {
# тут настройки
}
}
[error] 5#5: *8 no "ssl_certificate" is defined in server listening on SSL port while SSL handshaking
Answer the question
In order to leave comments, you need to log in
server {
listen 443 ssl default_server;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;
location / {
deny all;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question