server {
server_name banket-valencia.ru;
access_log /var/log/nginx/example.log;
location / {
proxy_pass http://127.0.0.1:8001;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# auth_basic "Авторизуйтесь";
# auth_basic_user_file /etc/nginx/.htpasswd;
}
location /static/ {
alias /var/www/banket-valencia.ru/static/;
}
location /uploads/ {
alias /var/www/banket-valencia.ru/uploads/;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/banket-valencia.ru/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/banket-valencia.ru/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = banket-valencia.ru) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name banket-valencia.ru;
listen 80;
return 404; # managed by Certbot
}
server {
listen 80;
server_name www.banket-valencia.ru;
return 301 https://banket-valencia.ru$request_uri;
}
dka@desktop ~ % http -vv https://www.banket-valencia.ru
GET / HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: www.banket-valencia.ru
User-Agent: HTTPie/3.2.1
http: error: SSLError: HTTPSConnectionPool(host='www.banket-valencia.ru', port=443): Max retries exceeded with url: / (Caused by SSLError(CertificateError("hostname 'www.banket-valencia.ru' doesn't match 'banket-valencia.ru'"))) while doing a GET request to URL: https://www.banket-valencia.ru/
Caused by SSLError(CertificateError("hostname 'www.banket-valencia.ru' doesn't match 'banket-valencia.ru'")))
server {
listen 80;
server_name www.example.com;
return 301 $scheme://example.com$request_uri;
}