服务器正在下载 phpmyadmin php 文件

服务器正在下载 phpmyadmin php 文件

似乎当我尝试访问 phpmyadmin 时,会下载索引文件。我不明白原因。我已经安装了 php,并且已经在配置中对其进行了配置。

# Expires map
map $sent_http_content_type $expires {
default                    off;
text/html                  epoch;
text/css                   max;
application/javascript     max;
~image/                    max;
}
server {

    root /var/www/hostitor.com/html;
    index index.html index.htm index.nginx-debian.html index.php;

    server_name hostitor.com www.hostitor.com;

    location / {
            try_files $uri $uri/ =404;
    }

     location ^~ /blog {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:2368;
}
    location ^~ /phpmyadmin {
    alias /var/www/hostitor.com/html/phpmyadmin;
try_files $uri $uri/ =404;
}

location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
    }

listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/hostitor.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/hostitor.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
expires $expires;
}
server {
if ($host = www.hostitor.com) {
    return 301 https://$host$request_uri;
} # managed by Certbot


if ($host = hostitor.com) {
    return 301 https://$host$request_uri;
} # managed by Certbot


    listen 80;
    listen [::]:80;

    server_name hostitor.com www.hostitor.com;
return 404; # managed by Certbot
}

答案1

已移除

location ^~ /phpmyadmin { 
alias /var/www/hostitor.com/html/phpmyadmin; try_files $uri $uri/ =404; 
}

接下来显示的是

The mysqli extension is missing. Please check your PHP configuration. See our documentation for more information.

所以我这样做了

sudo apt-get install php7.3-mysql
sudo apt-get install php7.2-mysqlnd

确保取消注释 extension=mysqli.so在你的php.ini

最后重启服务器

相关内容