myvesta / vesta

myVESTA Control Panel
https://myvestacp.com
GNU General Public License v3.0
262 stars 44 forks source link

phpmyadmin files returning 404 #69

Open darkworks opened 4 years ago

darkworks commented 4 years ago

Operating System (OS/VERSION):

Debian 10

VestaCP Version:

latest

Installed Software (what you got with the installer):

php-fpm, apache, nginx, mysql

Steps to Reproduce:

when i try to load phpmyadmin like http://mysite.com/phpmyadmin

then i get blank screen and when i checked in console and also error log i noticed there were a lot of 404 error on phpmyadmin assets

GET https://site.com/phpmyadmin/themes/pmahomme/jquery/jquery-ui.css net::ERR_ABORTED 404 site.com/:13 GET https://site.com/phpmyadmin/js/vendor/codemirror/lib/codemirror.css?v=5.0.2 net::ERR_ABORTED 404 site.com/:14 GET https://site.com/phpmyadmin/js/vendor/codemirror/addon/hint/show-hint.css?v=5.0.2 net::ERR_ABORTED 404 site.com/:15 GET https://site.com/phpmyadmin/js/vendor/codemirror/addon/lint/lint.css?v=5.0.2 net::ERR_ABORTED 404 site.com/:16 GET https://site.com/phpmyadmin/themes/pmahomme/css/theme.css?v=5.0.2&nocache=4778503790ltr&server=1 net::ERR_ABORTED 404 site.com/:19 GET https://site.com/phpmyadmin/js/vendor/jquery/jquery.min.js?v=5.0.2 net::ERR_ABORTED 404 site.com/:20 GET https://site.com/phpmyadmin/js/vendor/jquery/jquery-migrate.js?v=5.0.2 net::ERR_ABORTED 404 site.com/:22 GET https://site.com/phpmyadmin/js/vendor/sprintf.js?v=5.0.2 net::ERR_ABORTED 404 site.com/:23 GET https://site.com/phpmyadmin/js/ajax.js?v=5.0.2 net::ERR_ABORTED 404 site.com/:24 GET https://site.com/phpmyadmin/js/keyhandler.js?v=5.0.2 net::ERR_ABORTED 404 site.com/:25 GET https://site.com/phpmyadmin/js/vendor/bootstrap/bootstrap.bundle.min.js?v=5.0.2 net::ERR_ABORTED 404 site.com/:26 GET https://site.com/phpmyadmin/js/vendor/jquery/jquery-ui.min.js?v=5.0.2 net::ERR_ABORTED 404 site.com/:27 GET https://site.com/phpmyadmin/js/vendor/js.cookie.js?v=5.0.2 net::ERR_ABORTED 404 site.com/:28 GET https://site.com/phpmyadmin/js/vendor/jquery/jquery.mousewheel.js?v=5.0.2 net::ERR_ABORTED 404 site.com/:29 GET https://site.com/phpmyadmin/js/vendor/jquery/jquery.event.drag-2.2.js?v=5.0.2 net::ERR_ABORTED 404 site.com/:30 GET https://site.com/phpmyadmin/js/vendor/jquery/jquery.validate.js?v=5.0.2 net::ERR_ABORTED 404 site.com/:31 GET https://site.com/phpmyadmin/js/vendor/jquery/jquery-ui-timepicker-addon.js?v=5.0.2 net::ERR_ABORTED 404 site.com/:32 GET https://site.com/phpmyadmin/js/vendor/jquery/jquery.ba-hashchange-1.3.js?v=5.0.2 net::ERR_ABORTED 404

so should i need to create link between /usr/share/phpmyadmin and public_html ?

myvesta commented 4 years ago

By default, only hostname is configured properly to run /webmail/ and /phpmyadmin/ So, if you open https://your-hostname.com/phpmyadmin/ it will works.

If you want to load /webmail/ and /phpmyadmin/ on your site, do following:

1) Set hosting-webmail-phpmyadmin or hosting-legacy nginx proxy template to your-site.com

2) Edit /etc/php/fpm/7.3/pool.d/your-site.com.conf find group = yourusername (probably line 9) and change that line to: group = www-data

After that, restart php-fpm: service php7.3-fpm restart

It may be other php version (5.6, 7.0, 7.1, 7.2, 7.3, 7.4...)

darkworks commented 4 years ago

thanks

darkworks commented 4 years ago

thanks for support so by default phpmyadmin is now loading ok but when i try to change phpmyadmin url am getting 404 errors for phpmyadmin assets

as am on php-fpm so i updated phpmyadmin Alias it these locations but still getting 404 for its assets

/etc/nginx/conf.d/phpmyadmin.inc /etc/phpmyadmin/apache.conf

phpmyadmin.inc file

location /phpmyadmin678 {
    alias /usr/share/phpmyadmin/;

    location ~ /(libraries|setup) {
        return 404;
    }

    location ~ ^/phpmyadmin678/(.*\.php)$ {
        alias /usr/share/phpmyadmin/$1;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $request_filename;
    }
    location ~* ^/phpmyadmin678/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
        root /usr/share/;
    }
}

so any idea that is there is another location which i need to update ?

myvesta commented 4 years ago

What is happeing if you put hosting-legacy nginx proxy template?

darkworks commented 4 years ago

great with hosting-legacy url rewriting worked ,
i think it will be good if we add info to readme file regarding these various templates.

myvesta commented 4 years ago

We should make script for changing phpmyadmin and webmail URL. I will leave this ticket open until that.

kat0d commented 3 years ago

custom phpmyadmin URL is critical in my case. just now hat try, and there is a 404 resp from static files(NginX). try to change in template nginx files phpmyadmin path to my custom path, in nginx inc conf, etc. static file give me 404 resp. php and other non proxied files resp 200. have no time on experiments. will use VestaCP on ubuntu.

PS. ...20 min later oh, works!) just had uncomment try_files $uri @fallback; option in current nginx template file(copy of hosting-webmail-phpmyadmin with disabled access logs) but before this I had create custom NginX templates with my custom phpmyadmin path edit NginX phpmyadmin.inc in nginx configs and...forgot what else, think that's all(if we talk about nginx config). there must be a simple and proper way to change url.

example of /usr/local/vesta/data/templates/web/nginx/hosting-webmail-phpmyadmin.stpl

server {
    listen      %ip%:%proxy_ssl_port% ssl http2;
    server_name %domain_idn% %alias_idn%;

    ssl_certificate      %ssl_pem%;
    ssl_certificate_key  %ssl_key%;
    error_log  off;

    location / {
        proxy_pass      https://%ip%:%web_ssl_port%;
        location ~* ^.+\.(jpeg|jpg|png|gif|bmp|webp|ico|svg|svgz|ogv|webm|htc|m4v|mkv|mov|mpeg|mpg|wmv|exe|iso|dmg|swf|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv)$ {
            root           %docroot%;
            access_log     off;
            expires        max;
            add_header Cache-Control "public";
            # try_files      $uri @fallback;
        }
        location ~* ^.+\.(%proxy_extentions%)$ {
            root           %sdocroot%;
            access_log     off;
            gzip_static    on;
            expires        max;
            # try_files      $uri @fallback;
        }
    }

    location /webmail {
        disable_symlinks off;
        proxy_pass      https://%ip%:%web_ssl_port%;
        location ~* ^.+\.(%proxy_extentions%)$ {
            root           /var/lib/roundcube;
            access_log     off;
            expires        max;
            # try_files      $uri @fallback;
        }
    }

    location /custom-phpmyadmin {
        disable_symlinks off;
        proxy_pass      https://%ip%:%web_ssl_port%;
        location ~* ^.+\.(%proxy_extentions%)$ {
            root           /usr/share/phpmyadmin;
            access_log     off;
            expires        max;
            try_files      $uri @fallback;
        }
    }

    location /error/ {
        alias   %home%/%user%/web/%domain%/document_errors/;
    }

    location @fallback {
        proxy_pass      https://%ip%:%web_ssl_port%;
    }

    location ~ /\.ht    {return 404;}
    location ~ /\.svn/  {return 404;}
    location ~ /\.git/  {return 404;}
    location ~ /\.hg/   {return 404;}
    location ~ /\.bzr/  {return 404;}

    disable_symlinks if_not_owner from=%docroot%;

    include %home%/%user%/conf/web/snginx.%domain%.conf*;
}

example of /etc/nginx/conf.d/phpmyadmin.inc

location /custom-phpmyadmin {
    alias /usr/share/phpmyadmin;

    location ~ /(libraries|setup) {
        return 404;
    }

    location ~ ^/custom-phpmyadmin/(.*\.php)$ {
        alias /usr/share/phpmyadmin/$1;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $request_filename;
    }
    location ~* ^/custom-phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
        root /usr/share/phpmyadmin/;
    }
}