Jump to content

phpMyAdmin + nginx


Recommended Posts

Hello,

I'm new at using TCAdmin on Linux and I tried to install phpMyAdmin on nginx but something went wrong 🙃

I've installed the phpMyAdmin and added the file include snippets/phpmyadmin.conf; as a include in my nginx default.conf.

upstream tcadmin-fcgi {
        ip_hash;
        server unix:/home/tcadmin/Temp/fastcgi-socket-1;
        keepalive 32;
}

upstream tcadmin-fcgi-mvc {
        ip_hash;
        server unix:/home/tcadmin/Temp/fastcgi-socket-mvc-1;
        keepalive 32;
}

server {
        #the following line is required if you want to configure with Let's Encrypt
        server_name ryzen.timberhost.com.br;
        fastcgi_temp_path /home/tcadmin/Temp 1 2;
        client_body_temp_path /home/tcadmin/Temp 1 2;
        #access_log   /home/tcadmin/Logs/nginx.log;
        root /home/tcadmin/ControlPanel.MVC;
        index index.html index.htm default.aspx Default.aspx;
        include snippets/phpmyadmin.conf;

        #Support for Let's encrypt tools
        location /.well-known {
               try_files $uri $uri/ =404;
        }

        #Everything else served by fastcgi server
        location / {
               root /home/tcadmin/ControlPanel.MVC;
               fastcgi_ignore_client_abort on;
               fastcgi_pass tcadmin-fcgi-mvc;
               include fastcgi_params;
               fastcgi_split_path_info ^(.+\.as[pmh]x)(.*)$;
               fastcgi_param PATH_INFO $fastcgi_path_info;
               fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
               fastcgi_keep_conn on;
               fastcgi_buffering off;
               fastcgi_read_timeout 600s;
               gzip            on;
               client_max_body_size 100m;
       }

        #Everything else served by fastcgi server
        location /Aspx {
               root /home/tcadmin/ControlPanel;
               fastcgi_ignore_client_abort on;
               fastcgi_index Default.aspx;
               fastcgi_pass tcadmin-fcgi;
               include fastcgi_params;
               fastcgi_split_path_info ^(.+\.as[pmh]x)(.*)$;
               fastcgi_param PATH_INFO $fastcgi_path_info;
               fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
               fastcgi_keep_conn on;
               fastcgi_buffering off;
               fastcgi_read_timeout 600s;
               gzip            off;
               client_max_body_size 100m;
       }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/ryzen.timberhost.com.br/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/ryzen.timberhost.com.br/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}



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


        server_name ryzen.timberhost.com.br;
        listen   80;
    return 404; # managed by Certbot


}

The file phpmyadmin.conf contains this code:

location /phpmyadmin {
    root /usr/share/;
    index index.php index.html index.htm;
    location ~ ^/phpmyadmin/(.+\.php)$ {
        try_files $uri =404;
        root /usr/share/;
        fastcgi_pass unix:/run/php/php7.2-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include /etc/nginx/fastcgi_params;
    }

    location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
        root /usr/share/;
    }
}

The error I'm getting is the "502 Bad Gateway".

Does someone have any idea of how to fix it? Linux is not my thing... yet!

Link to comment
Share on other sites

You're trying to set two websites in the same vhost. That won't work. You need to define a new vhost - in other words; you need another 'server{}' block that's relevant for your phpMyAdmin domain.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Terms of Use