nginx同一非默认端口同时配置http和https

在配置好的非默认端口如8081,正常配置ssl,只需要在最后加入

error_page 497 https://$server_name:$server_port$request_uri; 

即可在访问http的时候跳转到https。

因为当配置https时用http访问就会报497错误。所以用error_page拦截497就可以实现http跳转https。

posted @ 2022-02-25 11:19  潇潇暮鱼鱼  阅读(616)  评论(0)    收藏  举报