gpt4 book ai didi

ssl - Openerp 总是使用 nginx 访问 http 而不是 https

转载 作者:太空宇宙 更新时间:2023-11-03 14:28:57 24 4
gpt4 key购买 nike

我在 8069 端口上运行了 openerp。这是 nginx conf:

server {
listen 80;
listen [::]:80;
listen 443 default ssl;
server_name www.erp.mysite.hr;
ssl on;
ssl_certificate /etc/ssl/eco/erp_mysite_hr/erp_mysite_hr.crt;
ssl_certificate_key /etc/ssl/eco/erp_mysite_hr/erp_mysite_hr.key;
ssl_session_timeout 30m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
if ($ssl_protocol = "") {
rewrite ^ https://$server_name$request_uri? permanent;
}
}

aand location goes here and port proxy which works...

并且当访问openerp时,除非在url中用https指定,否则总是http,这样它就可以工作,但它不会自动重定向到https。这是我得到的链接

http://erp.mysite.hr/web/login?redirect=http%3A%2F%2Ferp.mysite.hr%2Fweb

知道可能是什么问题吗?谢谢

最佳答案

这应该可以正常工作,任何 http 请求都将被重定向到 https,稍后将由 top block 获取。

server {
listen 443 default ssl;
server_name www.erp.mysite.hr;
ssl on;
ssl_certificate /etc/ssl/eco/erp_mysite_hr/erp_mysite_hr.crt;
ssl_certificate_key /etc/ssl/eco/erp_mysite_hr/erp_mysite_hr.key;
ssl_session_timeout 30m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
location / {
#do whatever you need here
}
}

server {
listen 80;
server_name www.erp.mysite.hr;
location / {
return 301 https://$host$request_uri$is_args$args;
}
}

关于ssl - Openerp 总是使用 nginx 访问 http 而不是 https,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54433924/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com