0

It seems that when I try to access phpmyadmin, the index file is downloaded. I don't understand the reason. I have installed php and also have configured it in the configuration.

# 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
    Try removing: `location ^~ /phpmyadmin { alias /var/www/hostitor.com/html/phpmyadmin; try_files $uri $uri/ =404; }` it appears to be unnecessary and is breaking PHP. – Richard Smith Sep 04 '20 at 17:21
  • Hi, that worked out perfectly! But now it is showing `The mysqli extension is missing. Please check your PHP configuration. See our documentation for more information.` I uncommented `extension=mysqli` but it is still showing the error. – Saumya Brata Dutt Sep 05 '20 at 07:24

1 Answers1

0

Removed

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

Next it was showing

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

So I did this

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

Make sure to uncomment extension=mysqli.so in your php.ini

Laslty restart the server