Click to See Complete Forum and Search --> : Another @#%*^ Virtual Host ?
I have RH 8.0 installed and apache up and running.
When I try to configure the virtual hosts I get an error
VirtualHost_default_:443 mixing * ports and non-* ports with a NameVirtualHost is not supported, procedding with undefined resutls
My config is
NameVirtualHost *
<VirtualHost *>
ServerRoot /var/www/html
ServerName www.mydomain.com
and then the log files in the examples
</VirtualHost>
<VirtualHost *>
ServerRoot /var/www/html/new dir to help keep things less cluttered
ServerName www.anotherdomain.com
and the log files as shown before
</VirtualHost>
I am still a bit of a newbie so my network stuff might be a bit messed up so don't rule out that and I do not have DNS which I don't think matters but then again I don't really know.
My network is just a router for my DSL connection
Thanks
Matt
vbp6us
02-03-2003, 04:44 PM
are you putting the ip in for the * place on the namevirtualhost?
Ex:
NameVirtualHost 192.168.1.100
<VirtualHost 192.168.1.100>
ServerRoot /var/www/html
ServerName www.mydomain.com
and then the log files in the examples
</VirtualHost>
<VirtualHost 192.168.1.100>
ServerRoot /var/www/html/new dir to help keep things less cluttered
ServerName www.anotherdomain.com
and the log files as shown before
</VirtualHost>
Do you get the errors after you type www.mydomain.com or do you get it when you start apace?
Yeagh I have. It restarts fine but all the domain names resolve to the main site.
I have created a new directory inside the main html for this site but it always resolves to /var/www/html and uses that index.html file.
It just occured to me that I may need to point the look up for the site to the other folder but I don't know if I just add the line like the httpd.conf file has for the main server root inside the <virtualhost> container or not.
I was getting the error when I started apache.
Thanks
Oops a type O
I have DocumentRoot instead of ServerRoot
I tried switching them but when I go to resatert the stopping says Failed but it still starts.
The 2.0 docs for apache says to use DocumentRoot though so I think I am still fine.
One more thing should my IP for the Virtual Hosts be set to my network IP or the IP that my Domain Name resolves to.
Sorry this is getting so lame
NegativeZERO
02-04-2003, 03:48 AM
You need to have a default virtual server. You have you main domain, then the seccond domain you want the server to handle and pull files form a diffrent path. Here is how I have my vhosts set up.
<VirtualHost *>
ServerName domain2.com
ServerAlias *.domain2.com
DocumentRoot /var/www/virtual/domain2.com/htdocs
CustomLog /var/log/httpd/domain2.com_agent_log agent
CustomLog /var/log/httpd/domain2.com_referer_log referer
CustomLog /var/log/httpd/domain2.com_access_log common
ErrorLog /var/log/httpd/domain2.com_error_log
DirectoryIndex index.shtml index.shtm index.phtml index.php index.php4 index.php3 index.cgi index.html index.htm
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
</VirtualHost>
<VirtualHost _default_>
ServerName domain1.com
ServerAlias *.domain1.com
DocumentRoot /var/www/virtual/domain1.com/htdocs
CustomLog /var/log/httpd/domain1.com_agent_log agent
CustomLog /var/log/httpd/domain1.com_referer_log referer
CustomLog /var/log/httpd/domain1.com_access_log common
ErrorLog /var/log/httpd/domain1.com_error_log
DirectoryIndex index.shtml index.shtm index.phtml index.php index.php4 index.php3 index.cgi index.html index.htm
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
</VirtualHost>
The <VirtualHost _default_> I have set to my main domwin, then the <VirtualHost *> I have set for the other domwin or subdomain I want. I set the doc root and cgi-bin(which I left out) and my log file dirs etc...... Hope this helps you solve your issue.
Mind you I'm running this off of one IP only, you would have to set it for the IP's you want each domain or IP each vhosts is set to.
Later
NZ
Ok, here is some new info.
After tryin my LAN and Internet Ip the results were still the same. Only got my main site.
The new thing that happened is that when I tried the <VirtualHost_default_> a different page came up. What i am thinking is that in the conf file it says that the first Virtual Host is the one that comes up when no specific request is present and I think that this may be the case. I have my domain names just forewarded to my IP address. So I think that maybe I am just getting a default page cause no "propper" request is being made that can be identified as fitting a virtual host container.
If this is true then do I have to set up a couple of DNS servers? And if so can I do it all on the same box?
pl1ght
02-06-2003, 07:02 PM
Go into your /etc/hosts file. make sure the name of your ServerName in your httpd.conf is on the 127.0.0.1 line. If there is a line with your IP and the ServerName/host. Delete it. Ive seen that cause the problem with the pages resolving to your main document root often.
You may be onto something. I have been playing around some more (mesing more suff up) and noticed that all request end up at my IP address not an actual host name. I think that the server is using its default path cause it isn't even getting a request from the global server name.
In my conf file I have
127.0.0.1 localhost.localdomain localhost
So you want me to deleate this correct and then could you give an example of what I need to put in. Would I also have to input names for each virtual account?
Thanks
pl1ght
02-08-2003, 10:05 AM
well, if thats all you have, and the localhost lor localhost.domain is what your ServerName says also. Then that is correct.
whatever your ServerName in the httpd.conf is, is what you want next to the 127.0.0.1 entry. You shouldnt need to put all your other vhosts in there unless you are behind a router or something.
ginkoomo
02-08-2003, 10:48 AM
Here's something you might want to check out. I had alot of trouble setting up a virtual host on my server. I was trying to set up my document roots in /var/www/html folder i.e. /var/www/html/www.domain1.com. When I tried to access the site I would get an error telling me I didn't have permission to access / . What I found was that there is a Directory command in the httpdcommon.conf that restricts where the server can access documents from. Now if your only running one site you can use the /var/www/html as your Document root or (at least on my version) it is also set up for /home/*/public_html as a document root. For us nexbux's *=wildcard. If you want to set up a Document root anywhere else you need to declare it in, if your using virtual host, your virtual host declaration. If your not using virtual host then you should be able to find this in your /etc/httpd/conf folder in httpdcommon.conf.
Im running mandrake 9.0 and Apache 1.3
Hope this helps
Peace
Ginko
pl1ght: It reads as what I have writen above. I tried to change it but I am not doing it correctly. I would resart and the start process would fail. Also when I echo $HOSTNAME it always says localhost not my server name. I have tried several ways but am not doing it right yet.
ginkoomo: thanks I'll look into it
pl1ght
02-08-2003, 01:25 PM
try changing your ServerName in the httpd.conf to localhost then. jsut for kicks then apachectl restart
KilerCris
02-08-2003, 11:54 PM
Hello, I just installed RedHat 8.0 and had the same problem.
Have a look in /etc/httpd/conf.d/ssl.conf You'll find another virtual host hidden in there
Ok I tried changing my servername to localhost still didn't work.
KilerCris: I found the file but what did you do to get yours to work.
Any other suggestions?
I have RH 8 installed on another computer so I will try setting up virtual hosts on that one.
Could I have a problem with my Domain Name rigistar and how they are sending the request to my server from their server?
blizz
02-09-2003, 09:45 PM
Hi,
'Q'
You have registered a domain name?
You have a static ip on your router?
You server is behind a dsl router?
What ip did you use when you configured your ethernet connection. ex: (192.168.1.100) or dhcp?
Your registrar or someone else providing your dns?
If so have you edited your zone file to point to your ip for www?
Hey nice questions,
I have my own domain name
I have a static ip number to my router
My server is behind the router with port 80 and 21 forewarded and DHPC is set to off so server ip is 192.168.0.8
My registar godaddy is the DNS.
I have no idea what the zone file is:p
KilerCris
02-10-2003, 01:45 AM
There is another virtual host at the bottom of that file. Comment it out/delete it/fix it
blizz
02-10-2003, 06:14 AM
Okay,
For Redhat 8 the only changes you need to make or verify in your httpd.conf are..
Listen 80
ServerName www.yourdomain.com:80
(actually you can comment# serverName out since you are using virtual hosting it should work with your domain as well.)
NameVirtualHost 192.168.0.8
# Virtual host yourdomain.com
<VirtualHost 192.168.0.8>
DocumentRoot /home/yourname/www/
ServerName yourdomain.com
ServerAlias www.yourdomain.com
</VirtualHost>
Just a suggestion here. Create yourself a folder in the /home directory with your name or something and create a folder under it called www, put your index.html file in there. Check that the group owner and file owner for the folders 'yourname' and 'www' and the index.html file are owned by you and are executable chmod 755. So your virtualhost will serve your site from the documentroot path like in the example above.
FIX YOUR DNS IT'S IMPORTANT -
Your domain is registered with godaddy any you are not running your own dns then the next step is to register your domain with an external dynamic DNS provider. Try http://www.zoneedit.com/. There are other providers for this service, but zoneedit.com provides FREE dns.
Once you register your domain with zoneedit.com they will give you 2 IP addresses for your authoritative nameservers. Write down these 2 addresses, go back to godaddy, and update your dns/nameserver information. Once this propogates through the systems, you'll be able to make all the DNS changes you need at zoneedit.com. (usually takes around 24 hours or so) You will need to then login at zoneedit and point www or web to your routers static ip for your domain.
Good luck
Ok, I'll give that a try. Just one more quick quesiton.
Why does the server name in the Virtual Host not have the www infront of the domain name as compared to the global server name?
Thanks for all the help.
blizz
02-10-2003, 12:43 PM
"the global server name"
The ServerName directive specifies the hostname of the system on which your server runs.
Depending on your network configuration, you may not need to specify this directive.
Hey all, thanks for the help.
It is all working now the way it should. The whole problem was with the DNS setup. I got it all working by setting it up at zone edit.
Thanks again
Matt
b_usa
04-06-2003, 04:20 AM
Was this ever resolved? I am having the same problem, same error message, same config (RH 8). I would love to hear how you solved your prob Q.
Sure:
My conf is as follows.
NameVirtualHost <server lan Ip address>
<VirtualHost LANip>
DocumentRoot /var/www/myFile
ServerName YOURdns
</VirtualHost>
You can have more files in there if you wish but that is all you need to get a new virtual server up. I have the primary server listed first in the virtual host file followed by my virtual servers.
Next I went to www.zoneedit.com. The reason being that my DNS name at godaddy didn't have a zone on it. When you set up at zoneedit they will give you two DNS servers. Then I went back to godaddy and switched my name servers to point to zone edits servers that they gave me. At zone edit I added the www infront of my domain name and everything worked.
I didn't have to do or change anything else in the conf file that what I have listed above. Set your global variables in the conf file then add the virtual hosts and your server will be set. Change your zone and then you will be unleashed on the world.
BTW I am in Oregon too. Milton-Freewater
Hope it helps
b_usa
04-06-2003, 01:52 PM
I tried your set up, hopefully its a go. IS there anyway I can check my own links?" Im getting sick of having to hang in an IRC channel for hours just to get someone to click on 2 links. I tried with an open proxie to no avail... Any ideas? Well, either way, could someone check these two and tell me if they each load a different page?
http://bryan.shacknet.nu
http://joe.shacknet.nu
Thanks...
They are different on my browser:)
b_usa
04-06-2003, 09:53 PM
Cool, I hope that means they worked... That would be such a relief. I will post my vhosts section so if it did work, it night be helpful to others...
# Use name-based virtual hosting.
#
Listen 80
NameVirtualHost 192.168.0.100
#
# 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 *>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>
<VirtualHost 192.168.0.100>
ServerAdmin b_usa@msn.com
DocumentRoot /var/www/html
ServerName bryan.shacknet.nu
ErrorLog logs/bryan.shacknet.nu-error_log
CustomLog logs/bryan.shacknet.nu-access_log common
</VirtualHost>
<VirtualHost 192.168.0.100>
ServerAdmin b_usa@msn.com
DocumentRoot /var/www/html/joe
ServerName joe.shacknet.nu
ErrorLog logs/joe.shacknet.nu-error_log
CustomLog logs/joe.shacknet.nu-access_log common
</VirtualHost>
<VirtualHost 192.168.0.100>
ServerAdmin b_usa@msn.com
DocumentRoot /var/www/html/daled
ServerName daled.shacknet.nu
ErrorLog logs/daled.shacknet.nu-error_log
CustomLog logs/daled.shacknet.nu-access_log common
</VirtualHost>
b_usa
04-06-2003, 09:54 PM
PS The IP is the IP of the server from inside my LAN. (two PC's and a D-Link DI-604 router)