Operating System - Linux
1758039 Members
2279 Online
108867 Solutions
New Discussion юеВ

Setting up a virtual server to listen on Port 80

 
SOLVED
Go to solution
Belinda Dermody
Super Advisor

Setting up a virtual server to listen on Port 80

I have a apache https server listening on port 443 and I get to it by going to https://, what I am looking for in guidance is how to set up a virtual server to listen to port 80 also and rederict it the secure port, so the users only have to type in .com The apache is running on RedHat Version E4 and Apache is 2.0.59.
3 REPLIES 3
Steven E. Protter
Exalted Contributor
Solution

Re: Setting up a virtual server to listen on Port 80

Shalom,

httpd.conf code

Virtual site:


ServerAdmin sprotter@investmenttool.com
DocumentRoot /web/tehillimsongs/htdocs
ServerName tehillimsongs.com:80
ServerAlias www.tehillimsongs.com
ScriptAlias /cgi-bin/ "/web/tehillimsongs/cgi-bin/"
ErrorLog logs/tehillimsongs.com.error_log
CustomLog logs/tehillimsongs.com.access_log common


This works http://www.tehillimsongs.com

That is not the primary for the webserver.

There is one shared ssl certificate on https

https works on all sites but since there can only be one certificate per ip address there is an intitial connect warning on all sites but the master.

config code:
standard ssl.conf
SSLCertificateFile /etc/httpd/conf/ssl.crt/shalom-cert.pem

That line added.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Ivan Ferreira
Honored Contributor

Re: Setting up a virtual server to listen on Port 80

Not sure if I understand what you want, but it seems that you want that secure connections is automatically established even when the client does not specify https in the URL. That is, redirect non secure port 80 to the secure port.

You can do it with mod_rewrite. Create a file called /etc/httpd/conf.d/mod_rewrite.conf with the following contents:

# Rewrite Rules.
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/webmail/(.*) https://%{SERVER_NAME}/webmail/$1 [R,L]

In this example, any request for http://yourserver.com/webmail will be redirected to https://yourserver.com/webmail
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Belinda Dermody
Super Advisor

Re: Setting up a virtual server to listen on Port 80

# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#

DocumentRoot "/usr/local/apache2/htdocs"
ServerName hlah.blahblah.com
ServerAdmin unixsysm@harrisconnect.com
ErrorLog /usr/local/apache2/logs/error_log
TransferLog /usr/local/apache2/logs/access_log

# Added by jmarrion, redirect to the https page (2006-08-18)