PHPMyAdmin 可能出现 NGINX 问题

发布于 2025-01-13 13:03:48 字数 3152 浏览 1 评论 0原文

用这个把我的头发拔掉! 我不明白为什么 PHPMyAdmin 登录正常并显示菜单,但没有显示数据库信息。左侧的数据库树消失了,管理数据库的主窗口也是空白的(只是空白区域)。 菜单加载正常,所以我怀疑与框架相关的问题,因为当我查看页面源代码时,那里没有 HTML。

我让 Certbot 安装了 LetsEncrypt 证书和 NGINX 1.20.2。 PHP 是 8.1.3 和 Ubuntu 20。我尝试过多次全新安装 PHPMyAdmin。

这是我的 NGINX 配置,以防我遗漏了一些东西:

sites-enabled/default



    server {
        listen 80 default_server;
        listen [::]:80 default_server;
    
        root /var/www/html;
    
        index index.html index.htm index.php;
    
        server_name _;
    
        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
        }
    
        add_header X-Frame-Options "ALLOW-FROM http://site.uk";
        add_header X-Frame-Options "ALLOW-FROM http://www.site.uk";
        add_header X-Frame-Options "ALLOW-FROM https://site.uk";
        add_header X-Frame-Options "ALLOW-FROM https://www.site.uk";
        add_header X-XSS-Protection "1";
        add_header X-Content-Type-Options nosniff;
    
    }
    
    server {
        root /var/www/html;
    
        index index.html index.htm index.php;
    server_name _; # managed by Certbot
    
    
        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
        }
    
        location ~ .php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/run/php/php8.1-fpm.sock;
        }
    
    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/fx5.uk/fullchain.pem; # managed by C>
    ssl_certificate_key /etc/letsencrypt/live/fx5.uk/privkey.pem; # managed by>
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
    
    }
    
    server {
    
    #changed
    if ($host = site.uk) {
        return 301 https://$host$request_uri;
    } # managed by Certbot
    
    
        listen 80 ;
        listen [::]:80 ;
    server_name _;
    return 404; # managed by Certbot
    
    }

nginx.conf



    user www-data;
    worker_processes auto;
    pid /run/nginx.pid;
    include /etc/nginx/modules-enabled/*.conf;
    
    events {
        worker_connections 768;
        # multi_accept on;
    }
    
    http {
    
        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;
        server_tokens off;
    
        include /etc/nginx/mime.types;
        default_type application/octet-stream;
    
        ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
        ssl_prefer_server_ciphers on;
    
        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;
    
        gzip on;
    
        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
    }

pulling my hair out with this one!
I can't figure out why PHPMyAdmin is logging in ok and showing menu's, but there is no database information displayed. The left hand database tree is gone and the main window where you would manage a database is also blank (just empty space).
The menus are loading ok so I suspect a frame related issue as when I look at page source, there is just no HTML there.

I have Certbot install a letsencrypt certificate and NGINX 1.20.2. PHP is 8.1.3 and Ubuntu 20. I have tried multiple fresh installs of PHPMyAdmin.

Here are my NGINX configs in case I am missing something there:

sites-enabled/default



    server {
        listen 80 default_server;
        listen [::]:80 default_server;
    
        root /var/www/html;
    
        index index.html index.htm index.php;
    
        server_name _;
    
        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
        }
    
        add_header X-Frame-Options "ALLOW-FROM http://site.uk";
        add_header X-Frame-Options "ALLOW-FROM http://www.site.uk";
        add_header X-Frame-Options "ALLOW-FROM https://site.uk";
        add_header X-Frame-Options "ALLOW-FROM https://www.site.uk";
        add_header X-XSS-Protection "1";
        add_header X-Content-Type-Options nosniff;
    
    }
    
    server {
        root /var/www/html;
    
        index index.html index.htm index.php;
    server_name _; # managed by Certbot
    
    
        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
        }
    
        location ~ .php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/run/php/php8.1-fpm.sock;
        }
    
    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/fx5.uk/fullchain.pem; # managed by C>
    ssl_certificate_key /etc/letsencrypt/live/fx5.uk/privkey.pem; # managed by>
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
    
    }
    
    server {
    
    #changed
    if ($host = site.uk) {
        return 301 https://$host$request_uri;
    } # managed by Certbot
    
    
        listen 80 ;
        listen [::]:80 ;
    server_name _;
    return 404; # managed by Certbot
    
    }

nginx.conf



    user www-data;
    worker_processes auto;
    pid /run/nginx.pid;
    include /etc/nginx/modules-enabled/*.conf;
    
    events {
        worker_connections 768;
        # multi_accept on;
    }
    
    http {
    
        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;
        server_tokens off;
    
        include /etc/nginx/mime.types;
        default_type application/octet-stream;
    
        ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
        ssl_prefer_server_ciphers on;
    
        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;
    
        gzip on;
    
        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
    }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文