HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Installation/Configuration (http://www.howtoforge.com/forums/forumdisplay.php?f=4)
-   -   ssl on phpmyadmin (http://www.howtoforge.com/forums/showthread.php?t=21014)

rick z 4th March 2008 23:32

ssl on phpmyadmin
 
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

falko 5th March 2008 16:14

What's the output of
Code:

ls -la /var/www
?

rick z 6th March 2008 01:45

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

thecaoticone 6th March 2008 08:19

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.

rick z 6th March 2008 15:25

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!

rick z 7th March 2008 03:04

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?

thecaoticone 7th March 2008 06:16

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-Ap...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.

Quote:

NameVirtualHost xxx.xxx.x.xxx:80
<VirtualHost xxx.xxx.x.xx:80>

ServerName mysite.com
ServerAlias www.mysite.com
ServerAdmin webmaster@mysite.com

DocumentRoot /var/www/mysite/

<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>

<Directory /var/www/mysite/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
# This directive allows us to have apache2's default start page
# in /apache2-default/, but still have / go to the right place
# RedirectMatch ^/$ /apache2-default/
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error,crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>


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

</Location>
</IfModule>
</IfModule>

</VirtualHost>

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

Let me know if this helped.

rick z 10th March 2008 16:30

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!!!

skara 2nd November 2009 19:47

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
Quote:

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

Alias /phpmyadmin /usr/share/phpmyadmin
... (rest stays the same)
Hope it helps anybody else too

greetz
skara

Dixie 22nd October 2010 12:12

Skara

Your comment works really well :)

It is efficient and effective, thanks!

Dixie


All times are GMT +2. The time now is 15:17.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.