ssl on phpmyadmin

Discussion in 'Installation/Configuration' started by rick z, Mar 4, 2008.

  1. rick z

    rick z New Member

    Hi

    I have install ubuntu 7.10 server version and install phpmyadmin using "apt-get install phpmyadmin" How could I get it to force redirect using https instead http? I look on the phpmyadmin website, but I didn't see the phpmyadmin file(s) under /var/www. I think on the ubuntu install it is on other directory.

    On all my other site under /var/www/mysite I could manully type https://mysite/ without any error.

    Please help...

    Thanks.
    Rickz
     
  2. falko

    falko Super Moderator Howtoforge Staff

    What's the output of
    Code:
    ls -la /var/www
    ?
     
  3. rick z

    rick z New Member

    Here is the results. I am wondering if the install "phpmyadimin on ubuntu" is directed to some other place. What command can I use to find out what's been symbolic link to /var/www ?

    root@test:~# ls -la /var/www
    total 32
    drwxr-xr-x 7 root root 4096 2008-03-03 00:17 .
    drwxr-xr-x 15 root root 4096 2008-02-14 00:32 ..
    drwxr-xr-x 2 root root 4096 2008-02-20 00:10 apache2-default
    drwxr-xr-x 2 root root 4096 2008-03-03 00:17 eyeos
    -rw-r--r-- 1 root root 44 2008-02-19 22:53 info.php
    drwxr-xr-x 16 ftpuser www-data 4096 2008-02-21 21:07 joo
    drwxr-xr-x 2 root root 4096 2008-02-28 17:37 ko
    drwxr-xr-x 2 root root 4096 2008-03-02 06:25 webalizer
     
  4. thecaoticone

    thecaoticone New Member

    If you are using a straight Apache configuration ( not ISP ) you can add a rewrite in your site conf file.

    If you are using the default conf, add this to your /etc/apache2/sites-available/default

    <IfModule mod_rewrite.c>
    <IfModule mod_ssl.c>
    <Location /phpmyadmin>
    RewriteEngine on
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://mysite.com/phpmyadmin [R]
    </Location>
    </IfModule>
    </IfModule>


    Then restart Apache.
     
    Last edited: Mar 6, 2008
  5. rick z

    rick z New Member

    Thank you for the suggestion!!!

    Hi thecaoticone,

    Thank you for the quick tip. I will give that a try tonight.

    So for the installation using 'apt-get install phpmyadmin' it has to be done at the /etc/apache2/sites-available/default directory but not the phpmyadmin directory. You know,... I was going around the phpmyadmin's website & goolging and couldn't find this simple step that you are providing... In the phpmyadmin's website I found something like "$cfg['ForceSSL'] boolean - Whether to force using https while accessing phpMyAdmin" But I couldn’t find the configuration files. Any how… Thank you!
     
  6. rick z

    rick z New Member

    The http://mysite/myphpadmin did not get redirect to https after input the following code.

    <IfModule mod_rewrite.c>
    <IfModule mod_ssl.c>
    <Location /phpmyadmin>
    RewriteEngine on
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://mysite.com/phpmyadmin [R]
    </Location>
    </IfModule>
    </IfModule>


    Any suggestion?
     
  7. thecaoticone

    thecaoticone New Member

    First off, I told you wrong. The correct file is:

    /etc/apache2/sites-available/000-default

    not:

    /etc/apache2/sites-available/default

    My apologies for that mistake.

    You will need to load the rewrite_mod for apache:

    sudo a2enmod rewrite

    You also need to change AllowOverride from None to All in the first 2 directory blocks.

    A better example for this is here:

    http://www.xpheas.com/mod_rewrite-Apache-and-Ubuntu-Gutsy_a18.html



    Here is an example of /etc/apache2/sites-available/000-default using a rewrite for phpmyadmin.

    If you do not use the default conf change to the conf you created for your main site.


    Just a note, I came across this in the Squirrelmail configuration.

    Let me know if this helped.
     
  8. rick z

    rick z New Member

    it's working now.

    I was able to get it re-direct to https with my new install ubuntu last weekend. Thank you so much!!!
     
  9. skara

    skara New Member

    May i grab it from deep of the grounds ? (Just in case i ever forget it myself ;) )

    Debian/Ubuntu-release of PhpMyAdmin is configured in /etc/apache2/conf.d/phpmyadmin.conf

    Following forces my clients to use https vHost-independent
    Hope it helps anybody else too

    greetz
    skara
     
  10. Dixie

    Dixie New Member

    Skara

    Your comment works really well :)

    It is efficient and effective, thanks!

    Dixie
     

Share This Page