Fedora Linux Support Community & Resources Center
  #1  
Old 25th April 2008, 09:12 AM
neo_fox Offline
Registered User
 
Join Date: Apr 2005
Location: Schaafheim
Posts: 7
Apache with and without SSL == Site with https and http

Hi

I have a small problem.
My Apache is configured in this way that I have one IP and more VirtualHost

Something like this:
Code:
NameVirtualHost 123.456.7.89
..
<VirtualHost subdomain.site.com >
....
</VirtualHost>

<VirtualHost subdomain2.site.com>
</VirtualHost>

<VirtualHost subdomain.othersite.com>
...
</VirtualHost>
Now I need to have one site with SSL Encryption.
So I tried something like this
Code:
NameVirtualHost 123.456.7.89
..
<VirtualHost subdomain.site.com >
      ServerName subdomain.site.com
</VirtualHost>

<VirtualHost subdomain.othersite.com>
...
</VirtualHost>   

<VirtualHost subdomain.site.com >
      ServerName subdomain.site.com:443
      SSLCertificateFile /etc/httpd/ssl/cert.crt
      SSLCertificateKeyFile /etc/httpd/ssl/cert.key    
      SSLEngine on
......
</VirtualHost>
In this way the subdomain.site.com was accessible via https and all sites returning 400 - bad request when I tried to access it via http.

I read a bit and found out that the SSL encrypted site have to have own IP address. So I ordered new IP and tried this:

DNS-Entry shows subdomain.site.com on IP 123.456.7.900

Code:
NameVirtualHost 123.456.7.89
..
<VirtualHost subdomain.site.com >
      ServerName subdomain.site.com
</VirtualHost>

<VirtualHost subdomain.othersite.com>
...
</VirtualHost>   

<VirtualHost 123.456.7.900 >
      ServerName subdomain.site.com:443
      SSLCertificateFile /etc/httpd/ssl/cert.crt
      SSLCertificateKeyFile /etc/httpd/ssl/cert.key    
      SSLEngine on
......
</VirtualHost>
Now are all other site ok again (accessible via HTTP).
But the site I need to secure subdomain.site.com is accessible via https.
If I try to access it with http I get 400 - bad request.

What I need to do is to have:
- Several named based VirtualHost without encryption
- One or more sites with SSL encryption
- One or more sites accessible with and without SSL encryption
- I have 5 IP addresses available for it.

It is possible?

Kind regards,
Neo
Reply With Quote
  #2  
Old 30th April 2008, 09:26 AM
savage Offline
Registered User
 
Join Date: Jun 2005
Location: Mission Control
Posts: 1,229
Try specifying the port on the VirtualHosts line:
Code:
<VirtualHost 1.2.3.4:443>
and doing the same for the non-encrypted, with port 80.
Reply With Quote
  #3  
Old 30th April 2008, 11:06 AM
barf Offline
Registered User
 
Join Date: Dec 2004
Location: UK
Age: 59
Posts: 274
Quote:
Originally Posted by neo_fox
Hi

Code:
NameVirtualHost 123.456.7.89:80
..
<VirtualHost 123.456.7.89:80 >
      ServerName subdomain.site.com
</VirtualHost>

<VirtualHost 123.456.7.89:80>
... ServerName subdomain.othersite.com
</VirtualHost>   

<VirtualHost 123.456.7.900 :*>
      ServerName othersubdomain.site.com
      SSLCertificateFile /etc/httpd/ssl/cert.crt
      SSLCertificateKeyFile /etc/httpd/ssl/cert.key    
      SSLEngine on
......
</VirtualHost>

Kind regards,
Neo
This might help see my annotations in red above. Note you cannot have a name virtual host and an ip virtual host with the the same servername. Also to use the wildcard as a port identifier you need to tell the server to listen on 443 and 80 in the main configuration.
__________________
Stop making excuses, start making progress.
Reply With Quote
Reply

Tags
apache, http, https, site, ssl

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Site only visible through https, want only visible through http. jackliddle Servers & Networking 3 4th June 2008 07:07 PM
http to https redirect problems with Internet Explorer, servers are FC8 apache 2.2 garbagedigger Servers & Networking 0 7th May 2008 01:45 AM


Current GMT-time: 10:11 (Saturday, 25-10-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat
Koforidua - Trudovoye Travel Photos on Instagram - Mettupalayam