Join the community today
Become a Member

SSL can I issue ssl with for phpmyadmin tool ?

Discussion in 'Domains, DNS, Email & SSL Certificates' started by kanran111, Sep 6, 2021.

  1. kanran111

    kanran111 New Member

    Jul 13, 2021
    Local Time:
    2:27 AM
    As the title, can i do it? And is there encounter with acmetool when it renew by cronjob.

  2. eva2000

    eva2000 Administrator Staff Member

    May 24, 2014
    Brisbane, Australia
    Local Time:
    5:27 AM
    Nginx 1.25.x
    MariaDB 10.x
    Currently, there is no automated way to do that as the phpmyadmin is operating from main hostname which is responsible for other admin/stats URL access. But you can manually do it using below steps though I advise you don't due to security leak outlined at bottom of this post about using SSL certificate transparency logs public access to find out your hostname.

    The only thing that can mess up virtual.conf main host is if you install addon. Otherwise, you can manually setup main hostname outlined in Getting Started Guide step 1 with HTTPS using vhost generator at Generate Centmin Mod Nginx Vhost - LEMP Nginx web stack for CentOS

    type on domain fieldin main host name domain which has to have valid DNS A record pointing to server ip i.e. and check box that says Generate Self-Signed SSL / Letsencrypt SSL HTTPS Vhost (File ONLY) *

    Vhost type = basic and hit submit

    follow first 3 commands only to get letsencrypt ssl cert but edit web root from
    /home/nginx/domains/ to point to /usr/local/nginx/html and remove www. domain from -d

    enable letsencrypt in 123.09beta01 - 3 commands
    Code (Text):
    touch /etc/centminmod/
    echo "LETSENCRYPT_DETECT='y'" >> /etc/centminmod/
    /usr/local/src/centminmod/addons/ acmeupdate

    get letsencrypt ssl cert - 1 line cmd - webroot defined by -w /usr/local/nginx/html
    Code (Text):
    /root/ --force --issue --days 60 -d -w /usr/local/nginx/html -k 2048 --useragent centminmod-centos-acmesh-webroot --log /root/centminlogs/ --log-level 2

    install letsencrypt ssl cert - 2 line cmds
    Code (Text):
    mkdir -p /usr/local/nginx/conf/ssl/
    /root/ --installcert -d --certpath /usr/local/nginx/conf/ssl/ --keypath /usr/local/nginx/conf/ssl/ --capath /usr/local/nginx/conf/ssl/ --reloadCmd /usr/bin/ngxreload --fullchainpath /usr/local/nginx/conf/ssl/

    then make a copy of /usr/local/nginx/conf/conf.d/virtual.conf as /usr/local/nginx/conf/conf.d/virtual.ssl.conf
    Code (Text):
    cp -a /usr/local/nginx/conf/conf.d/virtual.conf /usr/local/nginx/conf/conf.d/virtual.ssl.conf

    now edit within /usr/local/nginx/conf/conf.d/virtual.ssl.conf with ssl cert lines so looks like
    Code (Text):
    server {
      listen 443 ssl http2;
      ssl_certificate      /usr/local/nginx/conf/ssl/;
      ssl_certificate_key  /usr/local/nginx/conf/ssl/;
      include /usr/local/nginx/conf/ssl_include.conf;
      http2_max_field_size 16k;
      http2_max_header_size 32k;
      http2_max_requests 5000;
      # dual cert supported ssl ciphers
      ssl_prefer_server_ciphers   on;
      #add_header Alternate-Protocol  443:npn-spdy/3;
      #add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
      #add_header X-Frame-Options SAMEORIGIN;
      #add_header X-Xss-Protection "1; mode=block" always;
      #add_header X-Content-Type-Options "nosniff" always;
      #spdy_headers_comp 5;
      ssl_buffer_size 1369;
      ssl_session_tickets on;
      # enable ocsp stapling
      resolver valid=10m;
      resolver_timeout 10s;
      ssl_stapling on;
      ssl_stapling_verify on;
      ssl_trusted_certificate /usr/local/nginx/conf/ssl/;
            root   html;
            access_log              /var/log/nginx/localhost.access.log     combined buffer=8k flush=1m;
            error_log               /var/log/nginx/localhost.error.log      error;
    # ngx_pagespeed & ngx_pagespeed handler
    #include /usr/local/nginx/conf/pagespeed.conf;
    #include /usr/local/nginx/conf/pagespeedhandler.conf;
    #include /usr/local/nginx/conf/pagespeedstatslog.conf;
    # limit_conn limit_per_ip 16;
    # ssi  on;
            location /nginx_status {
            stub_status on;
            access_log   off;
            #allow youripaddress;
            deny all;
                location / {
    # block common exploits, sql injections etc
    #include /usr/local/nginx/conf/block.conf;
    #Enables directory listings when index file not found
    #autoindex  on;
    include /usr/local/nginx/conf/staticfiles.conf;
    include /usr/local/nginx/conf/include_opcache.conf;
    include /usr/local/nginx/conf/php.conf;
    #include /usr/local/nginx/conf/phpstatus.conf;
    include /usr/local/nginx/conf/drop.conf;
    #include /usr/local/nginx/conf/errorpage.conf;
    #include /usr/local/nginx/conf/vts_mainserver.conf;

    restart nginx
    Code (Text):

    now you should be able to access both https and non-https hostname and then if all is working do a non-https to https 302 temp redirect

    If you do have installed phpmyadmin, you can probably try this to fix the conflict via these steps.

    1. Get the contents of /usr/local/nginx/conf/phpmyadmin_https.conf and place it in your above created
    /usr/local/nginx/conf/conf.d/virtual.ssl.conf main hostname HTTPS nginx vhost within server{} context

    2. Backup locally copy of auto generated self-signed SSL cert HTTPS vhost at /usr/local/nginx/conf/conf.d/phpmyadmin_ssl.conf

    3. Then take the below following values contained within /usr/local/nginx/conf/conf.d/phpmyadmin_ssl.conf and transpose them into your above created
    /usr/local/nginx/conf/conf.d/virtual.ssl.conf main hostname HTTPS nginx vhost within server{} context
    Code (Text):
    keepalive_timeout 3000;
    client_body_buffer_size 256k;
    client_body_timeout 3000s;
    client_header_buffer_size 256k;
    ## how long a connection has to complete sending
    ## it's headers for request to be processed
    client_header_timeout 60s;
    client_max_body_size 512m;
    connection_pool_size 512;
    directio 512m;
    ignore_invalid_headers on;
    large_client_header_buffers 8 256k;

    4. Then remove /usr/local/nginx/conf/conf.d/phpmyadmin_ssl.conf

    5. Test Nginx config & Restart Nginx & PHP-FPM
    Code (Text):
    nginx -t

    One important note, issuing a valid SSL certificate on your main hostname will allow folks to look up your issued valid SSL certificate in certificate transparency databases so they can get all your domain's subdomain/hostnames and then use that list to query each domain's real IP address.

    So if you have Cloudflare proxy protecting and hiding your real server IP for Nginx vhosts on Centmin Mod server but have valid SSL certificate on main hostname without Cloudflare proxy, then you'd leak your real server IP and if you enabled Cloudflare proxy on that main hostname, you'd break email deliverability on the Centmin Mod server as reverse PTR lookup for main hostname won't be able to return the real server IP and instead return Cloudflare proxy edge server IP - see Email - Steps to ensure your site/server email doesn't end up in spam inboxes.

    In which case, you would need to setup a 3rd party SMTP Postfix relay on Centmin Mod server to send server email from rather than your own Postfix MTA server i.e. use Amazon SES which is only one of a few 3rd party SMTP providers which do not pass real server IP in mail headers. See Amazon AWS - Amazon AWS SES SMTP Transactional Email Info
  3. MaximilianKohler

    MaximilianKohler Member

    Jun 23, 2023
    Local Time:
    12:27 PM
    That seems to conflict with this page? Addon - LEMP Nginx web stack for CentOS which says
  4. eva2000

    eva2000 Administrator Staff Member

    May 24, 2014
    Brisbane, Australia
    Local Time:
    5:27 AM
    Nginx 1.25.x
    MariaDB 10.x uses self-signed SSL cert which is untrusted in web browsers, so when you visit the page you need to manually override and view the page. You will still have an encrypted HTTPS session, just not with a live browser trusted SSL certificate like Letsencrypt or ZeroSSL.