Tuesday, September 27, 2016

enable ssl on phpmyadmin

1- install packages
$ sudo apt-get install phpmyadmin easy-rsa

2- create certificate and keys for phpmyadmin
$ cd /usr/share/easy-rsa
$ mkdir keys
$ touch keys/index.txt
$ echo 01 > keys/serial
$ source ./vars
$ export PATH=$PATH:/usr/share/easy-rsa
$ pkitool --initca


3- enable ssl module of apache2 server
$ sudo a2enmod ssl

4- create vhost configure file name and path /etc/apache2/sites-enabled/phpmyadmin.conf with content below

<IfModule mod_ssl.c>
    <VirtualHost _default_:443>
        ServerAdmin webmaster@localhost
        DocumentRoot /usr/share/phpmyadmin
        ServerName phpmyadmin.test.domain
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        SSLEngine on
        SSLCertificateFile    "/usr/share/easy-rsa/keys/ca.crt"
        SSLCertificateKeyFile "/usr/share/easy-rsa/keys/ca.key"
        <FilesMatch "\.(cgi|shtml|phtml|php)$">
                SSLOptions +StdEnvVars
        </FilesMatch>
        <Directory /usr/lib/cgi-bin>
                SSLOptions +StdEnvVars
        </Directory>
    </VirtualHost>
</IfModule>


5- finally restart the apache2 service
$ sudo /etc/init.d/apache2 restart

- snapshot of phpmyadmin web with ssl encryption session


No comments:

Post a Comment