LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 10-04-2004, 01:50 PM   #1
otisthegbs
Member
 
Registered: May 2003
Location: Vancouver
Distribution: RH9
Posts: 100

Rep: Reputation: 15
Apache + SSL + Virtual Hosts


I'm currently running RH9 and Apache 2.0.40 with mod_ssl. I have two domains that I own, the first domain (from now on, know as tld-1.com) has two hosts (from now on know as host-1 and host-2) my second domain (tld-2.com) has three hosts (host-1 host-2 securehost-1)

The problem is that when I enable ssl (yes my certificate is certified- cacert.org, the gods gift to open source) all of the other virtual hosts give me NOTHING but the 400 Bad Request error. I can't figure out why. There is of course two conf files for this, httpd.conf and ssl.conf. Now it seems to me that apache parses the ssl.conf file first before the httpd.conf, that's just my theory. Here a mockup of my httpd.conf file, see if you can spot the prob.

NameVirtualHost tld-1.com

<VirtualHost tld-1.com>
ServerAdmin admin@tld-1.com
DocumentRoot /var/www/html/tld-1.com
ServerName tld-1.com
ErrorLog logs/tld-1.com-error_log
CustomLog logs/tld-1.com-access_log common
</VirtualHost>
<VirtualHost host-2.tld-1.com>
ServerAdmin admin@tld-1.com
DocumentRoot /var/www/html/tld-1.com/host-2
ServerName host-2.tld-1.com
ErrorLog logs/host-2-tld-1.com-error_log
CustomLog logs/host-2-tld-1.com-access_log common
</VirtualHost>
<VirtualHost tld-2.com>
ServerAdmin admin@tld-2.com
DocumentRoot /var/www/html/tld-2.com
ServerName tld-2.com
ErrorLog logs/tld-2.com-error_log
CustomLog logs/tld-2.com-access_log common
</VirtualHost>
<VirtualHost host-2.tld-2.com>
ServerAdmin admin@tld-2.com
DocumentRoot /var/www/html/tld-2.com/host-2
ServerName host-2.tld-2.com.
ErrorLog logs/tld-2.com-host-2-error_log
CustomLog logs/tld-2.com-host-2-access_log common
</VirtualHost>

then the ssl.conf file looks like this

<VirtualHost securehost-1.tld-2.com>
ServerAdmin admin@tld-2.com
DocumentRoot /usr/local/nocat/htdocs
ServerName tld-2.com
ErrorLog logs/securehost-1.tld-2.com-error_log
CustomLog logs/securehost-1.tld-2.com-access_log common
ScriptAlias /cgi-bin/ /usr/local/nocat/cgi-bin/
<Directory /usr/local/nocat/cgi-bin>
SetEnv PERL5LIB /usr/local/nocat/lib
SetEnv NOCAT /usr/local/nocat/nocat.conf
</Directory>
# SetEnvIf User-Agent ".*MSIE.*" \
# nokeepalive ssl-unclean-shutdown \
# downgrade-1.0 force-response-1.0
# SSL Engine Switch:
# Enable/Disable SSL for this virtual host.
SSLEngine on
 
Old 10-04-2004, 03:38 PM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,118

Rep: Reputation: 315Reputation: 315Reputation: 315Reputation: 315
Looks like you're trying to set up your secure host as a name based virtual host. Sadly, name based virtual hosts and SSL do not work together. You'll need to make your secure host IP based (you don't need a new IP address, just send all port 443 [HTTPS] requests to the secure host), while the others can use name based virtual hosting. So instead of

<VirtualHost securehost-1.tld-2.com>

you need

<VirtualHost *:443>

to refer to your secure host.

If you want more than one secure virtual host, you'll need to acquire another IP address for the machine and put the appropraite IP address in instead of the *.
 
Old 10-04-2004, 04:14 PM   #3
otisthegbs
Member
 
Registered: May 2003
Location: Vancouver
Distribution: RH9
Posts: 100

Original Poster
Rep: Reputation: 15
K, so i did that and all the regular virtual hosts show up, which is great but the url https://securehost-1.tld-2.com now has a popup error from firefox saying

Quote:
The connection to securehost-1.tld-2.com has terminated unexpectanly. Some data may have been transferred.
 
Old 10-05-2004, 07:59 PM   #4
otisthegbs
Member
 
Registered: May 2003
Location: Vancouver
Distribution: RH9
Posts: 100

Original Poster
Rep: Reputation: 15
So my basic understanding is this: in apache you can only have TWO virtual hosts IF one of them is SSL

basically
<VirtualHost *:443>
means ALL 443 traffic goes here
<VirtualHost whatever>
ALL other traffic goes here

cause thats the only way i can get it to go. which sucks cause i have 4 virtual servers in addition to the SSL one.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
vsftpd, web uploads, vsftpd virtual users, apache virtual hosts, home directories jerryasher Linux - Software 7 02-18-2007 06:29 AM
apache-ssl setup virtual hosts notolerance Linux - Software 3 12-22-2005 04:20 PM
Mulltiple SSL Virtual Hosts w/Apache jrbush82 Linux - Software 3 04-12-2004 02:49 PM
Apache2, SSL, 2 Virtual Hosts franticbob Linux - Software 0 04-07-2004 09:48 PM
Apache: Virtual hosts pk21 Linux - Software 15 10-08-2002 05:08 PM


All times are GMT -5. The time now is 02:08 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration