Пытаюсь прикрутить ssl. Вроде получилось, но в web ui при каждом входе приходится менять порт.
Тема вроде поднималась еще в 2021-м. Так и не нашлось решения?
В nginx пересадил сайт на порт 8080.
Сделал редирект с 80 и поддержкой ACME:
server {
# redirect to https
listen 80;
location ^~ /.well-known/acme-challenge/ {
auth_basic "off";
allow all;
default_type "text/plain";
root /var/www/certbot;
}
location = /.well-known/acme-challenge/ {
auth_basic "off";
allow all;
return 404;
}
location / {
return 301 https://$hostname$request_uri;
}
}
Реверс прокся с редиректом короткого имени.
server {
listen 443 ssl default_server;
server_name wirenboard.example.ru;
ssl_certificate /etc/letsencrypt/live/$hostname/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/$hostname/privkey.pem;
if ($http_host != $server_name) {
return 301 https://$server_name$request_uri;
}
location / {
proxy_pass http://127.0.0.1:8080/;
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
}
location /mqtt {
proxy_pass http://localhost:18883;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade;
}
}