LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-19-2007, 05:09 PM   #1
I_like_TUX
Member
 
Registered: Sep 2007
Distribution: Fedora 7, Edubuntu
Posts: 35

Rep: Reputation: 15
SSL server cannot have its own DocumentRoot


Hi! I have the following setup (please note there are two IPs):

NameVirtualHost IP1:80

<VirtualHost IP1:80>
ServerName main_server:80
DocumentRoot "/var/www/html"
</VirtualHost>

<VirtualHost IP1:80>
ServerName 2nd_server:80
DocumentRoot "/var/www/2nd_server"
</VirtualHost>

<VirtualHost IP2:80>
ServerName 3rd_server:80
DocumentRoot "/var/www/3rd_server"
</VirtualHost>

<VirtualHost IP1:443>
ServerName main_server:443
DocumentRoot "/var/www/secure_html"
SSLEngine on
...
</VirtualHost>

I can go to main_server, 2nd_server and 3rd_server and go to the respective DocumentRoot. However, when I go to https://main_server,
I am directed to the DocumentRoot of main_server (/var/www/html) with https. Does any one have any suggestion? Is it because ServerName of the SSL server is also called main_server? (I would prefer that http://main_server goes to /var/www/html and https://main_server goes to /var/www/secure_html) Thank you.
 
Old 10-19-2007, 05:28 PM   #2
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Perhaps this is your problem

Quote:
Name-based virtual hosting cannot be used with SSL secure servers because of the nature of the SSL protocol.
Refer to: http://httpd.apache.org/docs/2.2/vhosts/name-based.html
 
Old 10-19-2007, 06:37 PM   #3
I_like_TUX
Member
 
Registered: Sep 2007
Distribution: Fedora 7, Edubuntu
Posts: 35

Original Poster
Rep: Reputation: 15
Thank you for your suggestion, I read the apache doc already and I understand that I cannot have more than one SSL server on the same "socket" (IP + port). Please note that in my configuration, I have name-based virtual hosts on IP1:80 but the SSL server on IP1:443.

I also tried to name the SSL server another name but the result is the same.

Thanks
 
Old 10-19-2007, 10:15 PM   #4
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
I had a look at my config, and my entries are:

ServerName main_server

not

ServerName main_server:443

I suspect you also need an entry

NameVirtualHost *:443

or similar before

<VirtualHost IP1:443>

Hope that helps - I don't claim to be an expert on apache, but mine does work.

Cheers


Bill
 
Old 10-28-2007, 08:45 PM   #5
I_like_TUX
Member
 
Registered: Sep 2007
Distribution: Fedora 7, Edubuntu
Posts: 35

Original Poster
Rep: Reputation: 15
Thanks God and thanks billymayday, it works now. The httpd.conf now looks like:

NameVirtualHost IP1:80
NameVirtualHost IP1:443

<VirtualHost IP1:80>
ServerName main_server:80
DocumentRoot "/var/www/html"
</VirtualHost>

<VirtualHost IP1:80>
ServerName 2nd_server:80
DocumentRoot "/var/www/2nd_server"
</VirtualHost>

<VirtualHost IP2:80>
ServerName 3rd_server:80
DocumentRoot "/var/www/3rd_server"
</VirtualHost>

<VirtualHost IP1:443>
ServerName main_server
DocumentRoot "/var/www/secure_html"
SSLEngine on
...
</VirtualHost>

Now every virtual host has its own document root.
 
  


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
jabber server ssl gabsik Linux - Networking 0 12-13-2006 04:22 AM
Cant Connect to SSL Server bobb_roof Linux - Enterprise 10 11-06-2006 08:06 AM
POP3 Server and SSL jackjill Linux - Software 0 12-08-2004 09:50 PM
plz help me with ssl on my server einstien Linux - Security 0 10-22-2004 11:48 AM
Server does not support SSL ??? markstevens Linux - Security 2 07-23-2003 12:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:15 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration