PHPmyAdmin 4.8.0 - nginx代理后面的apache2 - 登录时session_cookie错误



我将PHPmyAdmin更新到ubuntu 17.10下的新版本4.8.0。我在 apache 2.4.33 前面有 nginx 1.12.1 作为代理。现在,当我尝试登录时,我收到以下错误消息:

Failed to set session cookie. Maybe you are using HTTP instead of HTTPS to access phpMyAdmin.

在升级之前,一切正常。通过 apache-port 登录(没有 nginx(也可以。这是我的nginx配置:

server {
    listen 80;
    listen [::]:80;
    server_name phpmyadmin.localhost;
    index index.php index.nginx-debian.html index.html index.htm;
    location / {
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host $host;
        add_header X-Cache $upstream_cache_status;
        proxy_cache_valid 3s;
        proxy_no_cache $cookie_PHPSESSID;
        proxy_cache_bypass $cookie_PHPSESSID;
        proxy_cache_key $scheme$host$request_uri;
        proxy_pass http://127.0.0.1:8080/phpmyadmin$uri$is_args$args;       
    }
    location /phpmyadmin/ {
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host $host;
        add_header X-Cache $upstream_cache_status;
        proxy_cache_valid 3s;
        proxy_no_cache $cookie_PHPSESSID;
        proxy_cache_bypass $cookie_PHPSESSID;
        proxy_cache_key $scheme$host$request_uri;
        proxy_pass http://127.0.0.1:8080$uri$is_args$args;      
    }
}

有人知道出了什么问题吗?提前谢谢。

我能够重现这个问题。

对于此确切配置,此问题通过以下方式解决: proxy_cookie_path /phpmyadmin/ /;在其中一个位置块中。

http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cookie_path

使用 : nginx/1.14.0 (Ubuntu)

最新更新