nginx 监听一个端口同时支持https和http?

方法如下:

server {
  listen      1234 ssl;
  server_name your.site.tld;
  ssl         on;
  ...
  error_page  497 https://$host:1234$request_uri;
  ...
}

原文:https://ma.ttias.be/force-redirect-http-https-custom-port-nginx/

评论已关闭