Help - Search - Members - Calendar
Full Version: Configure Apache For Visrtualhost With No Ip?
Linuxhelp > Support > Technical Support
cagey cretin
Thank you for taking the time to read this.

Is it possible to configure Apache (I have v 2.0.40 running on RedHat 9.0) for VirtualHost with no IP? I have dynamic dns pointing to the server, and it works great for one site. I'd like to be able to host other sites here, but I have been getting error messages from apachectl configtest: "_default _:443 mixing * and non-* ports".

httpd.conf:

#
Listen 80
#
### Section 3: Virtual Hosts
##################################
#
# Use name-based virtual hosting.
#
NameVirtualHost *

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
<VirtualHost sitetohost.dyndns.org>
ServerAdmin webmaster@sitetohost.dyndns.org
DocumentRoot /var/www/html/sitetohost
ServerName sitetohost.dyndns.org
ErrorLog logs/sitetohost.dyndns.org-error_log
CustomLog logs/sitetohost.dyndns.org-access_log common
</VirtualHost>

Any help would be most appreciated,

Joe Wilk
hughesjr
This is where you want to look ! Can't do https:// though.
cagey cretin
Sadly, I've been there; done that.

I went back to make sure I had exhausted the options there. I have; I still either get each virtualhost answering to the main site, or answering nothing.
hughesjr
are you remembering to restart the httpd server with the command /etc/init.d/httpd restart after you make adjustments to httpd.conf?
cagey cretin
Well, no. I am rebooting. I assume that is going to clear out any threads or child processes...Man, I have tried every darn thing I can find in the rotten book and on the net...

Joe
hughesjr
OK ... try this:



CODE
NameVirtualHost *

<VirtualHost *>
ServerName sitetohost.dyndns.org
DocumentRoot /var/www/html/sitetohost
ServerAdmin webmaster@sitetohost.dyndns.org
ErrorLog logs/sitetohost.dyndns.org-error_log
CustomLog logs/sitetohost.dyndns.org-access_log common
</VirtualHost>
cagey cretin
QUOTE
Error Returned @ apachectl configtest:
[error] VirtualHost _default_:443 --mixing * and non-* ports with a name VirtualHost is not supported, proceeding with undefined results.


hughesjr
Can't use virtual hosts and SSL on the same server....got to take out the 443 listen and https stuff if you want to use virtual hosts...

Or maybe use:


NameVirtualHost sitetohost.dyndns.org:80

<VirtualHost sitetohost.dyndns.org:80>
ServerName sitetohost.dyndns.org
DocumentRoot /var/www/html/sitetohost
ServerAdmin webmaster@sitetohost.dyndns.org
ErrorLog logs/sitetohost.dyndns.org-error_log
CustomLog logs/sitetohost.dyndns.org-access_log common
</VirtualHost>
cagey cretin
[quote]I tried this:
NameVirtualHost sitetohost.dyndns.org:80

<VirtualHost sitetohost.dyndns.org:80>
ServerName sitetohost.dyndns.org
DocumentRoot /var/www/html/sitetohost
ServerAdmin webmaster@sitetohost.dyndns.org
ErrorLog logs/sitetohost.dyndns.org-error_log
CustomLog logs/sitetohost.dyndns.org-access_log common
</VirtualHost>
[/quote]

This failed to return any pages; possibly because Dyndns.Org isn't working right now. But, I did get a different error message:
[quote]

[error] (22003) Temporary failure in name resolution: unable to resolve sitetohost.dyndns.org.
[/quote]

HughesJr, you've mentioned SSL before:
[quote]
Can't use virtual hosts and SSL on the same server....got to take out the 443 listen and https stuff if you want to use virtual hosts...
[/quote]

How would I disable it? I searched the httpd.conf file and did not find a reference to ssl, 443, or https...
cagey cretin
Well, Dyndns.Org is back up, the error message went away, but I am still only getting the main site even when trying to browse to the virtualhost...
hughesjr
The reason I brought up the SSL is the error you were getting discusses 443 ... and SSL is not allowed ... it seemed like that might be a problem.
------------------------------------------------------------------------------
If you haven't already (back up your httpd.conf first) - take out all the information that refers to the primary website and make it a virtual entry ... then make a virtual entry for site 2.
cagey cretin
HughesJr, thanks so much for trying to get me on my feet. I really, really appreciate your time. Thank you. biggrin.gif

I took out the entire section 2, which refers to the main server, and put it in VirtualHost tags. First error was that I needed to move 'user' and 'group' directives out of the VirtualHost. Then, I had the trouble with 'mixing * and non-* ports'. . I rebooted, and the httpd [failed] at boot.

I replaced the conf file with the back up, and found a directive within the file that was commented out regarding the handling of Via Headers. I thought this might be it, so I uncommented it and setit to 'On' then 'Full' (read below):
QUOTE
# Enable/disable the handling of HTTP/1.1 "Via:" headers.
# ("Full" adds the server version; "Block" removes all outgoing Via: headers)
# Set to one of: Off | On | Full | Block
#
ProxyVia Full


Sadly, no soap.

2 Thoughts:

  • Would I have been able to accomplish virtual hosting without the SSL errors if I bought a certificate? If so, it would be worth the money to get the server working and get to something I really need to do, like repair the bathroom...
  • I'm not trying to be defeatist, but maybe I should try this on an MS platform.


Joe Wilk biggrin.gif
hughesjr
Send me a PM that has your httpd.conf file inside [code] tags and I will see what I can do....
cagey cretin
Mail's In...
hughesjr
I haven't tried with your httpd.conf yet ... but here is what I have working on my test server right now:


192.168.0.27 redhattest.home.local
192.168.0.27 newsite.home.local

(the servername is redhattest.home.local)...

here are the applicable parts of my httpd.conf:

CODE
NameVirtualHost redhattest.home.local

# Virtual host redhattest.home.local
<VirtualHost redhattest.home.local>
 DocumentRoot /var/www/html/
 ServerName redhattest.home.local
 DirectoryIndex index.html index.htm index.shtml index.php
</VirtualHost>

# Virtual host newsite.home.local
<VirtualHost newsite.home.local>
 DocumentRoot /var/www/html2/
 ServerName newsite.home.local
 DirectoryIndex index.html index.htm index.shtml index.php
</VirtualHost>

---------------------------------------------------------------------------------
The root directories are different for the newsite.home.local and redhattest.home.local....one site says this on index.html

This is RedHatTest .home.local ... it is different than the newsite.home.local
-----------------------------------------------------------------------------------
the other site says this:

This is newsite.home.local ... it is different than the main site
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
Totally off this point ... you don't want the root of the second site to be /var/www/html/sitename ... because it would also be accessable from the main site as
CODE
http://mainsite/sitename/
.
Instead you probably want to create a directory called /var/www/html-sitename for the new sites ... and point the document root for each virtual site to it's own directory ....(obviously sitename is whatever you want for each new site ... in the case you posted, I would use /var/www/html-sitetohost...
cagey cretin
Thank you HughesJr,

I have been poking and prodding over here, and I have tosay that I got it working. I wiped the hard drive clean and started fresh. I mean fresh. I created 4 VH entries as you suggested: the first for the main, the 2nd 3rd and 4th for the VHosts I needed. Fired right up. ohmy.gif

Thank you for 'holdng my hand' HJ. I really, really appreciate it!!!

biggrin.gif biggrin.gif biggrin.gif biggrin.gif biggrin.gif

Joe
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.