使用 nginx / php-fpm 登录后 phpmyadmin 空白页面

使用 nginx / php-fpm 登录后 phpmyadmin 空白页面

我可以访问www.***/phpmyadmin来登录。如果我使用 mysql 用户登录,则直接点击空白页,没有错误。系统运行在raspbian上。

安装:nginx 1.2.1,php5.4.36

我尝试从不同机器上的不同浏览器登录。我重置了cookie。网址更改为 phpmyadmin/index.php?token=****3a35b78052f67500a6bb2bd411e6

我的 nginx 配置:

    upstream php-handler {
    server 127.0.0.1:9000;
    #server unix:/var/run/php5-fpm.sock;
    }

    server {
    listen 80;
    server_name ***.net;
    return 301 https://$server_name$request_uri; # enforce https
    }

    server {
    listen 443 ssl;
    server_name ***.net;

    ssl_certificate /etc/nginx/cert.pem;
    ssl_certificate_key /etc/nginx/cert.key;

    ssl_ciphers "AES128+EECDH:AES128+EDH";
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:10m;
    add_header Strict-Transport-Security "max-age=63072000; includeSubDomains";
    add_header X-Frame-Options DENY;
    add_header X-Content-Type-Options nosniff;

    # Path to the root of your installation
    root /var/www/owncloud;

    client_max_body_size 1000M; # set max upload size
    fastcgi_buffers 64 4K;

    rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect;
    rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect;
    rewrite ^/webdav(.*)$ /remote.php/webdav$1 redirect;

    index index.php
    error_page 403 /core/templates/403.php;
    error_page 404 /core/templates/404.php;

    location = /robots.txt {
    allow all;
    log_not_found off;
    access_log off;
 }


# phpmyadmin
location /phpmyadmin {
alias   /usr/share/phpmyadmin;
index   index.php;
}

location ~ ^/phpmyadmin/libraries {
deny all;
}

location ~ ^/phpmyadmin/setup/lib {
deny all;
}

location ~ ^/phpmyadmin/setup/(.+\.php)$ {
auth_basic              "phpMyAdmin Setup";
auth_basic_user_file    "/etc/phpmyadmin/htpasswd.setup";
alias                   /usr/share/phpmyadmin/setup/$1;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass            php-handler;
fastcgi_index           index.php;
include                 fastcgi_params;
}

location ~ ^/phpmyadmin/(.+\.php)$ {
alias                   /usr/share/phpmyadmin/$1;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass            php-handler;
fastcgi_index           index.php;
include                 fastcgi_params;
}

location ~ ^/(?:\.htaccess|data|config|db_structure\.xml|README) {
    deny all;
}


location ~ \.php(?:$|/) {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_param HTTPS on;
    fastcgi_pass php-handler;
    fastcgi_index index.php;
}

# Optional: set long EXPIRES header on static assets
location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {
expires 30d;
# Optional: Don't log access to assets
access_log off;
}

}

我感谢您的帮助

答案1

我想我刚刚遇到了同样的问题,尽管是使用 Apache。如果您查看页面上的源代码,您是否会看到大部分 html 仍然是空框架?

如果是这样,那么问题很可能是由于 nginx 设置中的以下行所致:

add_header X-Frame-Options DENY;

将其设置为 SAMEORIGIN 为我带来了 phpmyadmin,该指令阻止页面在任何上下文中的框架中显示。

我在尝试的任何日志中都找不到任何错误。

答案2

看起来存在文件权限冲突,请为 nginx 和 php-fpm 设置相同的用户运行,最常见的“nginx”或“www-data”。配置文件是/etc/php-fpm.d/www.conf和/etc/nginx.conf。chown nginx:nginx /usr/share/phpmyadmin/*例如,您可以为 hpMyadmin 文件设置用户和组。

相关内容