Mr.Tlyer’s Blog

NAS 在Nginx环境下实现非443端口强制https访问

新建一个conf文件(模板参照/etc/nginx/app.d/server.webstation-vhost.conf文件修改):
/usr/local/etc/nginx/sites-enabled/web.conf

    server {
    listen      端口号 ssl http2 default_server;
    server_name xxx.xxx;
    ssl_certificate             /usr/local/../fullchain.pem;
    ssl_certificate_key         /usr/local/../privkey.pem;
    include /.conf*;
    error_page 497 301 https://$host:$server_port$request_uri;
    ssl_prefer_server_ciphers   on;
    include     proxy.conf;
    location / {
        proxy_pass  http://xxx.xxx.xxx:端口号;
    }
}
/etc/init.d/
nginx -s stop
nginx resart

参考链接:
https://segmentfault.com/a/1190000040908221
https://seeyon.ren/blog/index.php/archives/225/
https://v2ex.com/t/648986

当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »