LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-27-2003, 08:47 PM   #1
ohe
LQ Newbie
 
Registered: Aug 2003
Posts: 12

Rep: Reputation: 0
How to help: SSL only website


I am trying to setup a website that uses https only and not http.

I have seen several phrasing for doing so, but I am not sure which is correct. The one that make the most sense is:


SSLProtocal all
SSLCipherSuite HIGH:MEDIUM

But the directions call for putting it in the httpd.conf file. I am runnign the lattest Apache on Redhat 9. From what I see, all SSL commands are in the ssl.conf file, not in httpd.config.

Can someone tell me where and in which file it is suppose to go.

Also, will this mandate https and not http in so that when someone types in my domain name, they automaticly get https?
 
Old 09-27-2003, 09:55 PM   #2
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
It reads both files, I would put it in ssl.conf



Last edited by DavidPhillips; 09-27-2003 at 09:57 PM.
 
Old 09-27-2003, 10:06 PM   #3
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
you will need to close port 80 (turn off listen 80) and only allow port 443, or redirect http to https


I would have the virtualhost for ssl somewhere other than the default /var/www/html and put only index.php in /var/www/html

index.php
<?php
header("Location: https://my.domain.com/");
?>


you will also need to change the other folders like manual, cgi-bin, and any others to ssl

Last edited by DavidPhillips; 09-27-2003 at 10:08 PM.
 
Old 09-28-2003, 03:37 PM   #4
ohe
LQ Newbie
 
Registered: Aug 2003
Posts: 12

Original Poster
Rep: Reputation: 0
I am redirecting 80 to 443 but I am getting a "Bad Request" error page (400). It states:

Your browser sent a request that this server could not nderstand.
Reason: You're speaking plain HTTP to an SSL-enabled server port. Instead use the HTTPS scheme to access this URL, please.

Hint: https://new.host.name/

This is very much, an appropriate error. Now what I would like to do is create a custom error page that redirects http to https. I have the page crated and it works. But when I try to direct Apache to it, it seems like it ignores the command and uses the default settings. I tried to create a .htac.. file which direct 400 errors to the page and that did not work.

Am I doing something wrong?
Is there a better way?

Thanks for your feedback
Tony
 
Old 09-28-2003, 03:46 PM   #5
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
It sounds like you are redirecting port 80 to 443 using iptables rules or something like that. It won't work that way, the browsers header needs to be https.
 
Old 09-28-2003, 03:55 PM   #6
husfeldt
LQ Newbie
 
Registered: Aug 2003
Distribution: Redhat 9.0
Posts: 8

Rep: Reputation: 0
Use Rewrite rule

You could use the rewrite rules in your http.conf file to redirect all trafic to https..
This will alow you to either redirect without notice or to show a nice messgage like "you must use https to ..."
 
Old 09-28-2003, 09:56 PM   #7
ohe
LQ Newbie
 
Registered: Aug 2003
Posts: 12

Original Poster
Rep: Reputation: 0
What I am going to do is use a redirecting index.htm file and have it be the only fine in the /html. I will place all other files in a subdirectory.

All of the links will be automaticly linked to https when I create the pages. However, this will not prevent someone from typing in the full address without the https - meaning the files might be sent un-encripted.

Thanks for your feedback, it was helpfull

Tony
 
Old 09-28-2003, 10:06 PM   #8
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
you do not want to put the https document root in html, put it somewhere else, then the only file in html will be index.php


like this

ssl.conf
DocumentRoot /var/www/htmls


httpd.conf
DocumentRoot /var/www/html
 
Old 09-28-2003, 10:07 PM   #9
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
the redirect is also a good idea
 
Old 09-29-2003, 09:36 AM   #10
ohe
LQ Newbie
 
Registered: Aug 2003
Posts: 12

Original Poster
Rep: Reputation: 0
I setup my site last night according to your directions David, and it works great !!!!!!! Individuals are automatically redirected to the https page. If they try to type in a file location directly without the https (http only) they get an error page.

Great help -- thanks a million

Tony
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
vsFTPd - SSL connection and dynamic SSL ports toxoplasme Linux - Server 11 08-22-2008 10:50 PM
Securing a website directory with ssl? Doctor Doom Linux - Software 1 10-10-2005 06:58 PM
apache2 - ssl : connection via ssl interrupted ldp Linux - Software 0 10-02-2005 09:07 AM
My Website webwolf70 General 3 10-29-2004 09:16 AM
website khdo80 Linux - General 3 12-28-2003 11:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration