Welcome to Centmin Mod Community
Become a Member

Accidentally deleted hostname ssl certificates. Please help

Discussion in 'Install & Upgrades or Pre-Install Questions' started by redbird, Mar 31, 2023.

  1. redbird

    redbird Member

    90
    15
    8
    Aug 28, 2015
    Web
    Ratings:
    +25
    Local Time:
    1:58 PM
    • CentOS Version: CentOS 7 64bit
    • Centmin Mod Version Installed: 124stable
    Hey all,

    By accident I deleted hostname SSL files in
    /usr/local/nginx/conf/ssl/

    Any way to restore them? Re-install centminmod?

    :banghead:

     
    Last edited: Mar 31, 2023
  2. buik

    buik “The best traveler is one without a camera.”

    2,044
    527
    113
    Apr 29, 2016
    Flanders
    Ratings:
    +1,691
    Local Time:
    5:58 AM
    Restore back-up and you are good to go! :)
     
  3. eva2000

    eva2000 Administrator Staff Member

    55,896
    12,281
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,868
    Local Time:
    1:58 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Each time you upgrade Nginx an auto backup of nginx conf files and ssl directories is generated. See http://centminmod.com/nginx.html#autobackup and http://centminmod.com/configfiles.html.
    So if you accidentally deleted your Nginx vhost files at /usr/local/nginx/conf/conf.d/ and/or SSL files at /usr/local/nginx/conf/ssl/ you can restore a previous copy from /usr/local/nginxbackup which has 2 directories
    1. /usr/local/nginxbackup/confbackup which is backup for everything within /usr/local/nginx/conf including subdirectories like /usr/local/nginx/conf/conf.d/
    2. /usr/local/nginxbackup/nginxdirbackup which is backup for everything within /usr/local/nginx/ including subdirectories
    Code (Text):
    ls -lah /usr/local/nginxbackup
    total 32K
    drwxr-xr-x.   4 root root 4.0K Apr  4  2017 .
    drwxr-xr-x.  22 root root 4.0K Sep  9 05:27 ..
    drwxr-xr-x. 212 root root  12K Nov 20 00:25 confbackup
    drwxr-xr-x. 212 root root  12K Nov 20 00:25 nginxdirbackup
    

    So for instance for backup dated 310817 = 31 August, 2017 at /usr/local/nginxbackup/confbackup/conf_310817-005457/conf.d/ would have Nginx vhost config files which were backed up from /usr/local/nginx/conf/conf.d/
    Code (Text):
    ls -lah /usr/local/nginxbackup/confbackup/conf_310817-005457/conf.d/
    
    -rw-r--r--  1 root root 1.1K Aug 30 18:55 demodomain.com.conf
    -rw-r--r--  1 root root 2.0K Aug 30 18:55 domain1.com.conf
    -rw-r--r--  1 root root 3.3K Aug 30 18:55 domain1.com.ssl.conf
    -rw-r--r--  1 root root  846 Aug 30 18:55 ssl.conf
    -rw-r--r--  1 root root 2.6K Aug 30 18:55 virtual.conf
    

    and /usr/local/nginxbackup/confbackup/conf_310817-005457/ssl would contain the nginx ssl certificate files backed up from /usr/local/nginx/conf/ssl

    So contents of /usr/local/nginxbackup/confbackup/conf_310817-005457/ssl
    Code (Text):
    ls -lah /usr/local/nginxbackup/confbackup/conf_310817-005457/ssl
    
    drwxr-xr-x. 2 root root 4.0K Apr  4  2017 domain1.com
    

    has /usr/local/nginxbackup/confbackup/conf_310817-005457/ssl/domain1.com backups for /usr/local/nginx/conf/ssl/domain1.com
    Code (Text):
    ls -lah /usr/local/nginxbackup/confbackup/conf_310817-005457/ssl/domain1.com
    total 40K
    drwxr-xr-x. 2 root root 4.0K Apr  4  2017 .
    drwxr-xr-x. 6 root root 4.0K Jun 23 11:24 ..
    -rw-r--r--. 1 root root  424 Apr  4  2017 dhparam.pem
    -rw-r--r--. 1 root root  952 Apr  4  2017 domain1.com-backup.csr
    -rw-r--r--. 1 root root 1.7K Apr  4  2017 domain1.com-backup.key
    -rw-r--r--. 1 root root 1.1K Apr  4  2017 domain1.com.crt
    -rw-r--r--. 1 root root  952 Apr  4  2017 domain1.com.csr
    -rw-r--r--. 1 root root 1.7K Apr  4  2017 domain1.com.key
    -rw-r--r--. 1 root root   45 Apr  4  2017 hpkp-info-primary-pin.txt
    -rw-r--r--. 1 root root   45 Apr  4  2017 hpkp-info-secondary-pin.txt
    
     
  4. redbird

    redbird Member

    90
    15
    8
    Aug 28, 2015
    Web
    Ratings:
    +25
    Local Time:
    1:58 PM
    George, you are da man. Thank you as always.
     
  5. eva2000

    eva2000 Administrator Staff Member

    55,896
    12,281
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,868
    Local Time:
    1:58 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    You're welcome. The take away is always keep Nginx versions updated via centmin.sh menu option 4 just purely for auto Nginx backups :D