Ok so this was a bit tricky but I knew it would work and this is not for everyone out there. Remember this is a subdomain and I got a wildcart SSL from GoDaddy (look up my instructions for installing a GoDaddy certificate.
I am using Ubuntu 8.10 server for this and not many changes from the standard install. I want to support multiple sites through 443 on the same IP.
Go to /etc/apache2/ports.conf Here is what I have, your might be a bit different
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
NameVirtualHost *:80
Listen 80
<IfModule mod_ssl.c>
# SSL name based virtual hosts are not yet supported, therefore no
# NameVirtualHost statement here
NameVirtualHost *:443
Listen 443
</IfModule> |
Then setup the virtual host files just like normal. Here is the open close headers for this
<VirtualHost *:443>
....
</VirtualHost> |
So I have this secure shopping cart RoR project. I want people to simply navigate to the web address but when they get there I want them to automatically be moved over the the SSL version. I was looking for a simply solution one that I could very easily implement without changing much of the code of the site. Here is how I did it.
In Apache Virtual Host file on the *:80 config I have this set.
<VirtualHost *:80>
ServerName subdomain.domain.com
Redirect / https://subdomain.domain.com/
ServerAlias subdomain.domain.com
</VirtualHost> |
This will direct any of the information coming in on the port 80 over to the 443/https portion of the website. Make sure you have the HTTP portion configured properly.
I had to get a SSL certificate for a web site of mine yesterday. I decided to get another SSL certificate from GoDaddy. Here are my notes for getting the certificate.
I went ahead and created a folder to make all of my work in so that I could zip it up later or have the Rsync server grab it and save it in the main infrastructure.
mkdir /root/certificate_godaddy |
This will generate the randomized string create the csr.
openssl genrsa -out domain_name.key 1024 |
This will create the CSR for GoDaddy which will you will need to copy and paste into their site. If you are going to be requesting a Wild Card SSL make sure that the NAME is *.domain_name.com
openssl req -new -key domain_name.key -out domain_name.csr |
Now log into the GoDaddy site and paste the contents from the above CSR into their site. When you get the email back I suggest putting the 2 files they give you in the same location as you created the above. You will most likely have the following files.
domain_name.com.crt
gd_bundle.crt |
With those files you will need to setup the SSL virtual host like the below:
<VirtualHost *:443>
ServerName subdomain.domain_name.com
ServerAdmin user@domain.com
DocumentRoot "/home/user/vhosts/site_down"
DirectoryIndex index.html index.php
ErrorLog /var/log/apache2/secure_domain_name_error.log
<IfModule mod_ssl.c>
SSLEngine On
SSLCertificateFile "/home/user/csr/_.domain_name.com.crt"
SSLCertificateKeyFile "/home/user/csr/domain_name.com.key"
SSLCertificateChainFile "/home/user/csr/gd_bundle.crt"
</IfModule>
.. The rest of your config file
</VirtualHost> |
From here you should have no problems with the GoDaddy certificate. Hope this helps everyone.