Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Nginx作为Ajenti的反向代理_Nginx_Ubuntu 12.04 - Fatal编程技术网

Nginx作为Ajenti的反向代理

Nginx作为Ajenti的反向代理,nginx,ubuntu-12.04,Nginx,Ubuntu 12.04,我已根据-> 这会让我进入登录,但在我登录后,Ajenti会重定向到“/Ajenti:auth”,而不是“/Ajenti/Ajenti:auth” 例如:浏览器->HTTPS->Nginx->HTTP->Ajenti 这似乎也是“ajenti:static”资源的一个问题 见: 在Nginx中处理此问题的推荐方法是什么?以下是我的做法: 使用location~/ajenti.来匹配ajenti的资源URL 编辑:经过测试,效果良好。编辑:添加proxy\u set\u头来源http://$hos

我已根据->

这会让我进入登录,但在我登录后,
Ajenti
会重定向到“/Ajenti:auth”,而不是“/Ajenti/Ajenti:auth”

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

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

见:


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

以下是我的做法:

使用
location~/ajenti.
来匹配ajenti的资源URL


编辑:经过测试,效果良好。

编辑:添加
proxy\u set\u头来源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
    }
}

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

Hmm,这对我来说不起作用。我在位置的末尾添加了。*,得到了404。刚刚注意到(在浏览器控制台中)POST(在我登录后)返回“403 invalid origin”?您指定了正则表达式位置匹配吗?例如,
location~/ajenti.
我应该把它放在答案中,对不起,添加这一行就成功了,我猜,因为我正在做从HTTPS到HTTP的代理<代码>代理集头源http://$host-根据您的上述评论(Hardex),但http->“代理设置头来源http://$host;”谢谢:)
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
    }
}