https://github.com/python-telegram-bot/python-telegram-bot/wiki/Webhooks
Using nginx with one domain/port for all bots
All bots set their url to the same domain and port, but with a different url_path.
The integrated server should usually be started on the localhost or 127.0.0.1 address, the port can be any port you choose.
Note: example.com could be replaced by an IP address, if you have no domain associated to your server.
Example code to start the bot:
- updater.start_webhook(
- listen='127.0.0.1',
- port=5000,
- url_path='TOKEN1',
- webhook_url='https://example.com/TOKEN1',
- cert=open('cert.pem', 'rb')
- )
复制代码
Example configuration for nginx (reduced to important parts) with two bots configured:
- server {
- listen 443 ssl;
- server_name example.com;
- ssl_certificate cert.pem;
- ssl_certificate_key private.key;
- location /TOKEN1 {
- proxy_pass http://127.0.0.1:5000/TOKEN1/;
- }
- location /TOKEN2 {
- proxy_pass http://127.0.0.1:5001/TOKEN2/;
- }
- }
复制代码
请问 'cert.pem' 这个文件从哪里来的? |