Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Redirection help needed |
|
Author |
|
CliffD5
Joined: 11 Oct 2012 Posts: 2 Location: US
|
Posted: Thu 11 Oct '12 19:26 Post subject: Redirection help needed |
|
|
Disclaimer: I am an apache noob, so I am obviously doing something wrong.
I am in the process of setting up a VPS (Debian 6) as a mail server and want a webmail client (Roundcube) running as well. I need the webmail to be redirected to SSL. All other sites can be port 80, but I would like for them to work on 443 if it is directed manually in the address bar. I have this somewhat working so that http://mail.domain.org is redirected to https://mail.domain.org. http://domain.org works as intended, but if I go to https://domain.org, I get my webmail login screen, but this isn't reflected in the URL. I want https://domain.org to reflect the same content that is on http://domain.org Both mail.domain.org and domain.org are pointing to the same IP. Take a look at my current setup below. Any help is greatly appreciated!
Code: | <VirtualHost *:80>
ServerName domain.org
ServerAlias www.domain.org
ServerAdmin root@domain.org
DocumentRoot /var/www/public_html
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
<VirtualHost mail.domain.org:443>
ServerName mail.domain.org:443
ServerAdmin root@domain.org
DocumentRoot /var/www/webmail
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/mail.domain.org-ssl.crt
SSLCertificateKeyFile /etc/apache2/ssl/mail.domain.org-ssl.key
SSLCertificateChainFile /etc/apache2/ssl/sub.class1.server.ca.pem
SSLCACertificateFile /etc/apache2/ssl/ca.pem
</VirtualHost>
<Directory /var/www/webmail>
SSLRequireSSL
</Directory>
<VirtualHost *:80>
ServerName mail.domain.org:80
DocumentRoot /var/www/webmail
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
RedirectMatch Permanent ^/(?!exception/)(.*) https://mail.domain.org/$1
</VirtualHost>
|
|
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Thu 11 Oct '12 20:20 Post subject: |
|
|
You need to setup a second SSL vhost (for domain.org). |
|
Back to top |
|
CliffD5
Joined: 11 Oct 2012 Posts: 2 Location: US
|
Posted: Thu 11 Oct '12 22:26 Post subject: |
|
|
Nice. I believe this solved my problem. I figured it would be something simple, so thanks for the quick reply! |
|
Back to top |
|
|
|
|
|
|