PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > comp.info.servers.unix > How to make an Apache site SSL-only?
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.info.servers.unix Web servers for UNIX platforms.

How to make an Apache site SSL-only?

Réponse
 
LinkBack Outils de la discussion
Vieux 28/04/2006, 18h59   #1
workingstiff19@hotmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut How to make an Apache site SSL-only?

Apache 2.0 came with Fedora Core release 4 (Stentz), and the great news
is that it already serves up pages on SSL! :-) But I want it
SSL-only, i.e., I want no pages available on port 80, the users should
have to go to https:// (not http://)

My first attempt was to comment out this line in httpd.conf:
Listen 80
....but then "apachectl start" would not start the server.

Is it not so easy?

And is there a way to make it so that people who go to "http://" will
get redirected to the "https://" URL? I thought of using some
JavaScript command but the problem with that approach would be that
they would have to get to the home page via port 80 to get re-directed
and it's password-protected (a la one ".htaccess" file in the root
directory because I could not find the documentation explaining how to
restrict the whole server).

  Réponse avec citation
Vieux 28/04/2006, 19h24   #2
I R A Darth Aggie
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to make an Apache site SSL-only?

On 28 Apr 2006 10:59:26 -0700,
workingstiff19@hotmail.com <workingstiff19@hotmail.com>, in
<1146247166.367143.41880@e56g2000cwe.googlegroups. com> wrote:

>+ And is there a way to make it so that people who go to "http://" will
>+ get redirected to the "https://" URL?


I think you'll get everything you want if you simply rewrite the http:
requests into https: requests:. Here's one example:

http://sinnfrei.org/content/apache/index.html
http://www.whoopis.com/howtos/apache-rewrite.html

I don't know how good their recommendations are. I've only done very
minimal amounts of rewrite rules.

I would have suggested switching your "Listen 80" to "Listen 443", but
that's not going to stop someone from entering "http:" on a client.

--
Consulting Minister for Consultants, DNRC
I can please only one person per day. Today is not your day. Tomorrow
isn't looking good, either.
I am BOFH. Resistance is futile. Your network will be assimilated.
  Réponse avec citation
Vieux 28/04/2006, 19h24   #3
I R A Darth Aggie
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to make an Apache site SSL-only?

On 28 Apr 2006 10:59:26 -0700,
workingstiff19@hotmail.com <workingstiff19@hotmail.com>, in
<1146247166.367143.41880@e56g2000cwe.googlegroups. com> wrote:

>+ And is there a way to make it so that people who go to "http://" will
>+ get redirected to the "https://" URL?


I think you'll get everything you want if you simply rewrite the http:
requests into https: requests:. Here's one example:

http://sinnfrei.org/content/apache/index.html
http://www.whoopis.com/howtos/apache-rewrite.html

I don't know how good their recommendations are. I've only done very
minimal amounts of rewrite rules.

I would have suggested switching your "Listen 80" to "Listen 443", but
that's not going to stop someone from entering "http:" on a client.

--
Consulting Minister for Consultants, DNRC
I can please only one person per day. Today is not your day. Tomorrow
isn't looking good, either.
I am BOFH. Resistance is futile. Your network will be assimilated.
  Réponse avec citation
Vieux 28/04/2006, 19h24   #4
I R A Darth Aggie
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to make an Apache site SSL-only?

On 28 Apr 2006 10:59:26 -0700,
workingstiff19@hotmail.com <workingstiff19@hotmail.com>, in
<1146247166.367143.41880@e56g2000cwe.googlegroups. com> wrote:

>+ And is there a way to make it so that people who go to "http://" will
>+ get redirected to the "https://" URL?


I think you'll get everything you want if you simply rewrite the http:
requests into https: requests:. Here's one example:

http://sinnfrei.org/content/apache/index.html
http://www.whoopis.com/howtos/apache-rewrite.html

I don't know how good their recommendations are. I've only done very
minimal amounts of rewrite rules.

I would have suggested switching your "Listen 80" to "Listen 443", but
that's not going to stop someone from entering "http:" on a client.

--
Consulting Minister for Consultants, DNRC
I can please only one person per day. Today is not your day. Tomorrow
isn't looking good, either.
I am BOFH. Resistance is futile. Your network will be assimilated.
  Réponse avec citation
Vieux 29/04/2006, 04h47   #5
phil-news-nospam@ipal.net
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to make an Apache site SSL-only?

On 28 Apr 2006 10:59:26 -0700 workingstiff19@hotmail.com wrote:

| And is there a way to make it so that people who go to "http://" will
| get redirected to the "https://" URL? I thought of using some

This can be done. How to do it depends on whether you want any attempt
to directly reach a non-root URI (deep link) to go to the same place on
the HTTPS service, or force all such attempts to the make HTTPS page.

To just redirect HTTP to HTTPS and use the same URI:

<Virtualhost www.example.com:80>
Redirect / https://www.example.com/
</Virtualhost>

To redirect all URLs to the main page only:

<Virtualhost www.example.com:80>
RedirectMatch .* https://www.example.com/index.html
</Virtualhost>

If you want to be selective about it, put in multiple directives with
most specific to be matched first.

--
-----------------------------------------------------------------------------
| Phil Howard KA9WGN | http://linuxhomepage.com/ http://ham.org/ |
| (first name) at ipal.net | http://phil.ipal.org/ http://ka9wgn.ham.org/ |
-----------------------------------------------------------------------------
  Réponse avec citation
Vieux 29/04/2006, 04h47   #6
phil-news-nospam@ipal.net
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to make an Apache site SSL-only?

On 28 Apr 2006 10:59:26 -0700 workingstiff19@hotmail.com wrote:

| And is there a way to make it so that people who go to "http://" will
| get redirected to the "https://" URL? I thought of using some

This can be done. How to do it depends on whether you want any attempt
to directly reach a non-root URI (deep link) to go to the same place on
the HTTPS service, or force all such attempts to the make HTTPS page.

To just redirect HTTP to HTTPS and use the same URI:

<Virtualhost www.example.com:80>
Redirect / https://www.example.com/
</Virtualhost>

To redirect all URLs to the main page only:

<Virtualhost www.example.com:80>
RedirectMatch .* https://www.example.com/index.html
</Virtualhost>

If you want to be selective about it, put in multiple directives with
most specific to be matched first.

--
-----------------------------------------------------------------------------
| Phil Howard KA9WGN | http://linuxhomepage.com/ http://ham.org/ |
| (first name) at ipal.net | http://phil.ipal.org/ http://ka9wgn.ham.org/ |
-----------------------------------------------------------------------------
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 10h39.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,14931 seconds with 14 queries