gpt4 book ai didi

Nginx 作为 Ajenti 的反向代理

转载 作者:行者123 更新时间:2023-12-02 03:02:25 25 4
gpt4 key购买 nike

我已经按照 -> http://support.ajenti.org/topic/349870-ajenti-behind-nginx/Ajenti 设置了一个服务器 block

location /ajenti {
rewrite (/ajenti)$ / break;
rewrite /ajenti/(.*) /$1 break;

proxy_pass http://127.0.0.1:8000;
proxy_redirect / /ajenti/;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
}

这让我登录,但登录后 Ajenti 重定向到“/ajenti:auth”而不是“/ajenti/ajenti:auth”。

例如:浏览器 -> HTTPS -> Nginx -> HTTP -> Ajenti

这似乎也是“ajenti:static”资源的一个问题。

参见:http://support.ajenti.org/topic/88086-support-ajenti-behind-a-reverse-proxy/

Nginx 中处理此问题的推荐方法是什么?

最佳答案

编辑:添加 proxy_set_header Origin http://$host; 为我解决了这个问题。

升级到最新版本的ajenti后我也遇到了这个问题。错误 403 来源无效。这是我的设置。

server {
listen 443 ssl;
server_name ajenti.mymagicalwebsite.com;
ssl on;

if ($scheme = http) {
return 301 https://$server_name$request_uri;
}

location / {
proxy_pass http://localhost:8000;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 36000s; ## Timeout after 10 hours
}
}

有趣的是,在一个版本之前,它都可以使用完全相同的设置。

关于Nginx 作为 Ajenti 的反向代理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24483716/

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