我刚刚学习了以下教程:
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install python-certbot-nginx
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com
# Only valid for 90 days, test the renewal process with
certbot renew --dry-run这确实有效,但只适用于在主域上运行的客户端。但是,我还有一个API运行在端口8000上。当我访问mydomain.com:8000时,它确实将我重定向到https,但它显示了以下错误:

基本上它永远都是装的。
我已经允许https进入防火墙了。我的意思是,基本域工作得很好,只是端口8000不适用于https,它确实适用于http..。
server {
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /var/www/html/dexhub/client/build;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name www.iprofitmizer.com iprofitmizer.com; # managed by Certbot
error_page 404 /;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
location /api {
proxy_pass http://localhost:8000;
}发布于 2020-04-15 15:32:15
获得nodejs的最简单方法是通过这样的代理来定义它
location /api {
proxy_pass http://localhost:8000;
}在您的nginx虚拟主机配置(例如/etc/nginx/sites-enabled/my-site.conf)中。然后,您应该能够访问您的API通过https://iprofitmizer.com/api和certbot自动更新也应该工作。
否则,您必须将TLS支持集成到nodejs应用程序中。
https://serverfault.com/questions/1012430
复制相似问题