Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Thu Sep 10, 2015 9:17 am 
Offline
Junior Member

Joined: Thu Apr 16, 2015 9:44 am
Posts: 21
I have a great working Linode server with single IP and multiple domains - vhosts.

However, I need SSL for only one virtual host.

Configuration samples below for my-ssldomain.com (which is supposed to work with SSL) and my-nossldomain.com (one of the other domains which has nothing to do with SSL).

# my-ssldomain.com.conf
Code:
    <VirtualHost *:443>
      SSLEngine on
      ServerName my-ssldomain.com
      ...
    </VirtualHost>


# my-nossldomain.com.conf
Code:
    <VirtualHost *:80>
      ServerName my-nossldomain.com
      ...
    </VirtualHost>

https://my-ssldomain.com works as expected.

http://my-nossldomain.com works as expected.

https://my-nossldomain.com is not desired to be working, however it works unintentionally and first tries to load my-ssldomain.com's SSL certificate with a warning of course and if I select Continue then it opens my-ssldomain even it still shows https://my-nossldomain.com in the address bar.

I know that additional IP would solve this problem but I am trying to find single IP solution if any. If it is the only way then I would go that direction. But I have to make sure that Apache couldn't handle this.

Just to note: SSL is a self-signed cert which I am using for client authentication for an in-house web application. It doesn't matter but just in case, this is the setting.

Thank you in advance, for even reading.


Top
   
PostPosted: Thu Sep 10, 2015 10:18 am 
Offline
Linode Staff

Joined: Mon Sep 29, 2014 4:47 pm
Posts: 90
Twitter: FelicianoTech
TLS (SSL) is done at the port level in this case. When typing in https://my-nossldomain.com into your browser, it connects to your Linode via port 443, which then automatically looks for the SSL certificate for that IP addresses. This is before the hostname is looked at, virtual host are involved, etc.

Normally I'd say you'd want an additional IP however if you're already using a self-signed cert, you can simply create a vhost for https://my-nossldomain.com that includes a redirect (301) to the HTTP version of the site.


Top
   
PostPosted: Thu Sep 10, 2015 11:19 am 
Offline
Junior Member

Joined: Thu Apr 16, 2015 9:44 am
Posts: 21
Feliciano, thank you for your reply.

I actually tried this and created a *.443 virtual host entry for the my-nossldomain.com but it didn't help.
I did following:
Code:
<VirtualHost *:443>
        ServerName my-nossldomain.com
        RewriteEngine On
        RewriteRule ^/?(.*) http://my-nossldomain.com/$1 [R=301,L]
</VirtualHost>


But it still takes me to the https://my-ssldomain.com.

Now I wonder if I did something wrong in my configuration in rush. Are you sure that this will actually work? So what I am going to do is to have following in order:

Code:
# SSL Domain
<VirtualHost *:443>
      SSLEngine on
      ServerName my-ssldomain.com
      ...
</VirtualHost>

# NoSSL domain
<VirtualHost *:80>
      ServerName my-nossldomain.com
      ...
</VirtualHost>

# Redirection for NoSSL
<VirtualHost *:443>
        ServerName my-nossldomain.com
        RewriteEngine On
        RewriteRule ^/?(.*) http://my-nossldomain.com/$1 [R=301,L]
</VirtualHost>


It looks right?

Thank you.


Top
   
PostPosted: Thu Sep 10, 2015 11:49 am 
Offline
Junior Member

Joined: Thu Apr 16, 2015 9:44 am
Posts: 21
Decided to use additional IP. Web app already needs to be kind of "isolated", so win-win in this case.

Plus, now I'll have an IP if I need another domain to be SSL. I'll keep noSSL domains in one IP, SSL domains in other IP.

Thank you!


Top
   
PostPosted: Thu Sep 10, 2015 12:01 pm 
Offline
Linode Staff

Joined: Mon Sep 29, 2014 4:47 pm
Posts: 90
Twitter: FelicianoTech
smozgur wrote:
Decided to use additional IP. Web app already needs to be kind of "isolated", so win-win in this case.

Plus, now I'll have an IP if I need another domain to be SSL. I'll keep noSSL domains in one IP, SSL domains in other IP.

Thank you!


That sounds like a better plan. :D


Top
   
PostPosted: Thu Sep 10, 2015 12:05 pm 
Offline
Junior Member

Joined: Thu Apr 16, 2015 9:44 am
Posts: 21
Now I need to learn how to separate IPs with domains :) I've been setting up Name Based Virtual Hosts all the time, so I am now reading about IP Based + Name Based Virtual Hosts :) Hopefully it is not that complicated.

Thank you very much, Feliciano!


Top
   
PostPosted: Thu Sep 10, 2015 5:20 pm 
Offline
Junior Member

Joined: Thu Apr 16, 2015 9:44 am
Posts: 21
And just as I guessed - it is complicated. Actually really simple but somehow I made it complicated so it doesn't work :)

Feliciano, if you'd like to see my problem kind of started with this :) then please take a look at this new thread of mine:

Apache - Name Based Virtual Hosting - 2 IP Addresses


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group