Digital Ocean 托管上的 phpMyAdmin 404 错误

phpMyAdmin 404 error on Digital Ocean hosting

使用 Digital Ocean 的 guide 安装 phpMyAdmin 后出现 404 错误。我在 Ubuntu 运行 nginx 上设置了多个域。 /var/www/ 中有一个 phpmyadmin 目录。与指南的唯一区别是以下命令:

sudo ln -s /usr/share/phpmyadmin/ /var/www

我可能需要添加服务器块吗?由于我有多个域,每个域都有一个单独的配置文件。

示例配置文件:

server {
    listen 80 default_server;
    listen [::]:80 default_server;

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

    server_name MY_IP_ADDRESS;

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

    location /phpmyadmin {
        root     /var/www/;
        index index.php index.html;
    }

    location ~ \.php$ {
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root/$fastcgi_script_name;
        include        fastcgi_params;
        try_files      $uri /index.php;
    }

    location ~ /\.ht {
        deny all;
    }
}

我不擅长服务器管理。有什么建议么?

定义这个对我有用的服务器块。 您 case.As 中 phpmyadmin 的基本配置 您在 /var/www 中创建了符号 link。

sudo ln -s /usr/share/phpmyadmin/ /var/www

server {

    listen 80;
    server_name website.in www.website.in;
    autoindex on;

    location /phpmyadmin {
        root /var/www/;
        index index.php index.html;

        location ~ \.php$ {
            fastcgi_pass   unix:/var/run/php5-fpm.sock;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root/$fastcgi_script_name;
            include        fastcgi_params;
            try_files      $uri $uri/ /index.php;
        }
    }   

    location / {
        root /var/www/your/path;
        index index.php index.html;

        location ~ \.php$ {
            fastcgi_pass   unix:/var/run/php5-fpm.sock;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME $document_root/$fastcgi_script_name;
            include        fastcgi_params;
            try_files      $uri $uri/ /index.php;
        }
    }
}