[apache][phpmyadmin] change phpmyadmin to 443 using default phpmyadmin package

idea: rewrite engine to make http => https

1. go to .htaccess in /usr/share/phpmyadmin

add
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

2. activate the rewrite engine by a2enmod rewrite , then restart apache2

3. make SSL cert, some command like the following
#openssl req $@ -new -x509 -days 365 -nodes -out /etc/apache2/apache.pem -keyout /etc/apache2/apache.pem

details: http://www.debianadmin.com/install-and-configure-apache2-with-php5-and-ssl-support-in-debian-etch.html

4. permission for the cerf : #chmod 600 /etc/apache2/apache.pem

5. Listen 443 in ports.conf

6. Set the phpmyadmin conf in sites-available:

# phpMyAdmin default Apache configuration
Alias /phpmyadmin /usr/share/phpmyadmin

DocumentRoot /usr/share/phpmyadmin
SSLEngine on
SSLCertificateFile “/etc/apache2/apache.pem”

Options Indexes FollowSymLinks
AllowOverride All
DirectoryIndex index.php


AddType application/x-httpd-php .php

php_flag magic_quotes_gpc Off
php_flag track_vars On
php_flag register_globals Off
php_value include_path .

# Authorize for setup


AuthType Basic
AuthName “phpMyAdmin Setup”
AuthUserFile /etc/phpmyadmin/htpasswd.setup

Require valid-user

# Disallow web access to directories that don’t need it

Order Deny,Allow
Deny from All


Order Deny,Allow
Deny from All

7. Finish.

Posted in: web