LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-14-2006, 07:37 AM   #1
unkn0wn
Member
 
Registered: Mar 2006
Posts: 60

Rep: Reputation: 15
Apache HTTPS question


i setup SSL/TLS on apache 2.0.
Its working fine apache only listen on 443 port for incoming connections. My question is:
How to config apache , for example when user type www.dome.com to automatic redirect him to port 443 and https connection. Now when i use www.domain.com he dont display anything because apache don listen on 80.
 
Old 04-14-2006, 08:29 AM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
You would need to setup another vhost to listen on port 80 and then use an apache rewrite to point at the https address:
http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
 
Old 04-17-2006, 03:48 AM   #3
unkn0wn
Member
 
Registered: Mar 2006
Posts: 60

Original Poster
Rep: Reputation: 15
yes i create vhost form 80 port.
But rewrite is really complicated.
Is there some simple rule for my problem?

When i put in browser
http://domain.com/test i wan to redirect me to
https://domain.com/test
 
Old 04-17-2006, 09:37 AM   #4
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
This should work:
RewriteEngine on
RewriteRule ^/(.*) https://domain.com/$1
 
Old 04-18-2006, 03:41 AM   #5
unkn0wn
Member
 
Registered: Mar 2006
Posts: 60

Original Poster
Rep: Reputation: 15
i put in my host file in VirtualHost *:80

Code:
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
                # Uncomment this directive is you want to see apache2's
                # default start page (in /apache2-default) when you go to /
                #RedirectMatch ^/$ /apache2-default/
RewriteEngine on
RewriteRule ^/(.*) https://212.61.33.32/$1
   </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
but same thing didn work did i put rewrite in right place?
 
Old 04-18-2006, 02:59 PM   #6
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
Sorry, I think it's my mistake - I forgot the remote (external redirect) option:
RewriteRule ^/(.*) https://212.61.33.32/$1 [R]
 
Old 04-25-2006, 04:40 AM   #7
unkn0wn
Member
 
Registered: Mar 2006
Posts: 60

Original Poster
Rep: Reputation: 15
heh i put that in vhost file..


<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName x.x.x.x
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# Uncomment this directive is you want to see apache2's
# default start page (in /apache2-default) when you go to /
#RedirectMatch ^/$ /apache2-default/
#RedirectMatch permanent (/.*) https://x.x.x.x.
RewriteEngine on
RewriteRule ^/(.*) https://x.x.x.x./$1 [R]
</Directory>
<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
ServerSignature On

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>
</VirtualHost>

but same shit
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
 
  


Reply

Tags
apache, redirect, ssl


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to using HTTPS in Apache 2.0.54-10.1 Wimpie22 Linux - Software 1 08-24-2005 04:37 PM
can't switch https off with apache 2 barrys Mandriva 2 10-22-2004 07:56 AM
apache and https? xviddivxoggmp3 Linux - Software 3 04-16-2004 12:22 AM
Apache https question? mla Linux - Software 3 10-18-2003 05:20 PM
Apache https DavidPhillips Linux - General 3 03-11-2002 02:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:18 AM.

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