Welcome to Linux Forums!

With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.

Linux Forum ArticlesLinux ForumsLinux Forum DownloadsLinux Hosts
Home|Register|FAQ|Member List|Calendar|Unanswered Posts|Forum Rules|Today's Posts|Advanced Search|
SEARCH FOR IN
Go Back   Linux Forums > GNU Linux Zone > Servers
Reload this Page [SOLVED] Apache with and without SSL == Site with https and http
Linux Forums
Linux Forums
Welcome To The Linux Forums!
Welcome to Linux Forums. We pride ourselves in being one of the largest Linux communities on the web, we encourage you to REGISTER on our forums and participate in the community. There are over 150,000 members ready to answer your questions. JOINING US today will allow you to make new posts, get support, send messages to other members and submit downloads to our downloads directory and many other great features!

Servers Anything server related, Apache, MySQL, Samba, server security, sendmail, exim, etc

Closed Thread
 
Thread Tools Display Modes
Old 04-25-2008   #1 (permalink)
neo_fox
Just Joined!
 
Join Date: Nov 2005
Posts: 6
Send a message via ICQ to neo_fox
[SOLVED] 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
__________________
Joomla Directory Component: http://www.sigsiu.net/sobi2.html
Mambo Directory Component: http://www.sigsiu.net/sobi2.html
neo_fox is offline  
Old 04-25-2008   #2 (permalink)
jledhead
Linux Engineer
 
jledhead's Avatar
 
Join Date: Oct 2004
Location: North Carolina
Posts: 789
Quote:
Originally Posted by neo_fox View Post
Hi

It is possible?
Yes

I assume you have already changed it to listen on 443.

how about this
Code:
NameVirtualHost 123.456.7.89:80
NameVirtualHost 123.456.7.89:443
..
<VirtualHost subdomain.site.com:80 >
....
</VirtualHost>

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

<VirtualHost subdomain.othersite.com:443>
Your ssl stuff here.  and did you create the ssl
</VirtualHost>
restart apache and then do a
#tail -f /../../apache/error.log

and then try and access your ssl site and see what gets logged.
jledhead is offline  
Old 04-25-2008   #3 (permalink)
neo_fox
Just Joined!
 
Join Date: Nov 2005
Posts: 6
Send a message via ICQ to neo_fox
You have fully right this was exactly this problem.
It is neccessary to tell Apache to listing both ports for this IP and then the port has to be also defined in the VirtualHost name.

Thanks,
Neo
__________________
Joomla Directory Component: http://www.sigsiu.net/sobi2.html
Mambo Directory Component: http://www.sigsiu.net/sobi2.html
neo_fox is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT. The time now is 07:44 PM.




© 2000 - 2008 - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.0.0