LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Apache HTTPS question (http://www.linuxquestions.org/questions/linux-networking-3/apache-https-question-435062/)

unkn0wn 04-14-2006 07:37 AM

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.

david_ross 04-14-2006 08:29 AM

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

unkn0wn 04-17-2006 03:48 AM

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

david_ross 04-17-2006 09:37 AM

This should work:
RewriteEngine on
RewriteRule ^/(.*) https://domain.com/$1

unkn0wn 04-18-2006 03:41 AM

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?

david_ross 04-18-2006 02:59 PM

Sorry, I think it's my mistake - I forgot the remote (external redirect) option:
RewriteRule ^/(.*) https://212.61.33.32/$1 [R]

unkn0wn 04-25-2006 04:40 AM

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/


All times are GMT -5. The time now is 01:39 AM.