如何为我的主机中的每个端口配置SSL?[已关闭]

qmelpv7a  于 2022-12-27  发布在  其他
关注(0)|答案(1)|浏览(106)

此问题似乎与a specific programming problem, a software algorithm, or software tools primarily used by programmers无关。如果您认为此问题与another Stack Exchange site的主题有关,您可以留下评论,说明在何处可以回答此问题。
昨天关门了。
Improve this question
如果我们配置HTTPS,只有来自443的请求会被加密,但是我们如何为任何端口的请求配置HTTPS呢?

wxclj1h5

wxclj1h51#

我有办法...
我们可以通过使用nginx来实现这一点:

server {
  listen 1111-2222 ssl;
  server_name mysite.mydomain.com;

    ssl_certificate /etc/letsencrypt/live/mysite.mydomain.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/mysite.mydomain.com/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
}

通过更新配置文件中的nginx配置(默认路径为/etc/nginx/sites-available/default),服务器将在端口1111到2222上侦听传入的HTTPS请求。

相关问题