Всем привет! Изучаю java и параллельно пишу pet проект - вебхук телеграм бота. Для отладки локально использовал ngrok для получения адреса вебхука - все было норм. Однако когда пришел черед развернуть на собственном сервере - не взлетело. Помогите разобраться где ошибка и как это исправить.
Итак, имею vps от Timeweb. Там же крутится предыдущий бот, но без вебхуков - работает исправно.
На сервер получил SSL ключи через certbot
root@1559973-ci01275:~# ls /etc/letsencrypt/live/1559973-ci01275.twc1.net
cert.pem chain.pem fullchain.pem privkey.pem README
Настроил следующим образом nginx:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers off;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:10m;
ssl_session_tickets off;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
##
# Virtual Host Configs
##
server {
listen 443 ssl;
server_name 1559973-ci01275.twc1.net;
ssl_certificate /etc/letsencrypt/live/1559973-ci01275.twc1.net/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/1559973-ci01275.twc1.net/privkey.pem;
location /webhook {
proxy_pass http://127.0.0.1:5000;
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 $scheme;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Content-Length $http_content_length;
}
ssl_ciphers 'TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384';
ssl_ecdh_curve X25519:prime256v1;
ssl_dhparam /etc/nginx/dhparam.pem;
}
}
Отключил uwf:
root@1559973-ci01275:~# ufw status
Status: inactive
Задал endpoint для вебхука в коде
@RequestMapping(value = "/webhook", method = RequestMethod.POST)
Успешно зарегистрировал свой вебхук
ok true
result true
description "Webhook was set"
Однако, бот глух к командам... https://api.telegram.org/.../getWebhookInfo дает следующее:
ok true
result
url "https://1559973-ci01275.twc1.net/webhook"
has_custom_certificate false
pending_update_count 1
last_error_date 1702289241
last_error_message "Wrong response from the webhook: 404 Not Found"
max_connections 40
ip_address "89.223.121.78"
В логах nginx:
User
2023/12/11 02:33:49 [crit] 985841#985841: *2991 SSL_do_handshake() failed (SSL: error:0A00006C:SSL routines::bad key share) while SSL handshaking, client: 170.64.188.15, server: 0.0.0.0:443
2023/12/11 04:49:26 [crit] 985841#985841: *3035 SSL_do_handshake() failed (SSL: error:0A00006C:SSL routines::bad key share) while SSL handshaking, client: 74.82.47.4, server: 0.0.0.0:443
2023/12/11 05:07:18 [crit] 985841#985841: *3051 SSL_do_handshake() failed (SSL: error:0A00006C:SSL routines::bad key share) while SSL handshaking, client: 212.102.40.218, server: 0.0.0.0:443
2023/12/11 06:31:29 [crit] 985841#985841: *3079 SSL_do_handshake() failed (SSL: error:0A00006C:SSL routines::bad key share) while SSL handshaking, client: 118.26.39.120, server: 0.0.0.0:443
2023/12/11 07:08:44 [crit] 985841#985841: *3104 SSL_do_handshake() failed (SSL: error:0A00006C:SSL routines::bad key share) while SSL handshaking, client: 2001:470:1:c84::18, server: [::]:443
2023/12/11 10:21:16 [crit] 985841#985841: *3139 SSL_do_handshake() failed (SSL: error:0A00006C:SSL routines::bad key share) while SSL handshaking, client: 167.94.138.35, server: 0.0.0.0:443
2023/12/11 11:27:34 [emerg] 1524786#1524786: unexpected end of file, expecting "}" in /etc/nginx/nginx.conf:107
2023/12/11 11:29:37 [warn] 1524918#1524918: conflicting server name "1559973-ci01275.twc1.net" on 0.0.0.0:443, ignored
2023/12/11 11:29:47 [warn] 1524932#1524932: conflicting server name "1559973-ci01275.twc1.net" on 0.0.0.0:443, ignored
2023/12/11 11:29:47 [warn] 1524933#1524933: conflicting server name "1559973-ci01275.twc1.net" on 0.0.0.0:443, ignored