|
-
Webmaster
Virtual Hosts (Apache)
I have 2 domains routed to my home ip address which have Apache Webserver 2.0 up and running.
But to define what files are going to be used on Domain1 and Domain2, you need to set up "Virtual Hosts" on Apache in the config file. I have done that according to the documentation on the web, but still not working. But i guess the documentation is wrong somehow, and are forgetting some very important info that i should do.
Anyone setted up virtual hosts before ?
-
NameVirtualHost *
<VirtualHost xxx.xxx.xxx.xxx>
ServerName yourdomain.com
ServerAlias www.yourdomain.com
DocumentRoot /path/to/www
ServerAdmin [email protected]
</VirtualHost>
then:
killall -HUP httpd
Or start your server, and everything should be working.
-
Webmaster
Where do i type this "killall -HUP httpd" ?
Or does it only shutdown the apache server ?
-
killall -HUP
if your apache has a control panel, it should be something like "restart" or "reread config".
You just cannot edit the config and see it happen right away - the "reread config" makes for a shorter interruption of service than a restart
Addition to jstarkeys post: you can (and probably should) put logfile directives into the virtual sections as well
Musicman
-
Webmaster
And how do i add log directives ?
(Hard to fly like a bird, when you ain't a bird)
-
Hi,
just check the log config for the main server. You can place the same directives into the <virtualhost></virtualhost> parts as well and thereby create individual files
Error log is just:
ErrorLog /path/to/your/logfile
LogLevel warn
For details of access log, check the examples in the existing conf
Musicman
-
Webmaster
Remember i don't wanna have both domains pointing at the same folder.
At the script you gave me, you only describe 1 DocumentRoot .. and 1 Server.
Here is what was in the documentation that makes much more sense:
NameVirtualHost *
<VirtualHost *>
ServerName www.domain.tld
DocumentRoot /www/domain
</VirtualHost>
<VirtualHost *>
ServerName www.otherdomain.tld
DocumentRoot /www/otherdomain
</VirtualHost>
But does it work ? NOPE !!
I added this sign infront of every line above "#"
Thats correct right ?
Here is what i modified in the example above to suit what i need:
NameVirtualHost *
<VirtualHost *>
ServerName www.teamfox.org
DocumentRoot /www/teamfox
</VirtualHost>
<VirtualHost *>
ServerName www.dreamcore.org
DocumentRoot /www/dreamcore
</VirtualHost>
Was that correctly modified by me ?
-
Originally posted by Musicman
Addition to jstarkeys post: you can (and probably should) put logfile directives into the virtual sections as well
That would be ok with a few VHs. But remember, each time you add log directives, you're taking up more file descriptors. These can be pretty heavy on apache and the OS. I actually shut myself out of a remote machine two years ago by having too many.
-
Originally posted by Johnny Shiro
I added this sign infront of every line above "#"
Thats correct right ?
'#' is the comment mark. Apache will see that and ignore everything from that point til the beginning of the next line (or EOF, whichever is first).
If you have that at the beginning of any line, that line will be completely ignored.
-
Webmaster
hehe..you're right ! Thanks for saying that..i had totally forgot that !!
But now both domains displays the same htm file.
I have specified it to use a different folder for domain 2. Just see here:
# Use name-based virtual hosting.
NameVirtualHost 80.202.21.3
<VirtualHost 80.202.21.3>
ServerName www.teamfox.org
DocumentRoot www
</VirtualHost>
<VirtualHost 80.202.21.3>
ServerName www.dreamcore.org
DocumentRoot www/dreamcore
</VirtualHost>
-
Hi,
for some reason your server does not obey the virtualhosts at all - the page you get is the "main server" page.
I think this is a good time to check the error log whether it states anything about a config problem.
Also, since you probably do not have problems with multiple IPs, you could just try the
<VirtualHost: *>
It would probably be worth to put the teamfox entry in a directory by itself, and place a different index file in the main server
Musicman
Last edited by Musicman; 10-03-2002 at 01:28 PM.
-
Webmaster
I checked the error log and it said " IT couldnt find the dreamcore doc root (domain 2 )
So i changed it to this:
NameVirtualHost *
<VirtualHost *>
ServerName www.teamfox.org
DocumentRoot c:/foxserv/www/teamfox
</VirtualHost>
<VirtualHost *>
ServerName www.dreamcore.org
DocumentRoot c:/foxserv/www/dreamcore
</VirtualHost>
I gave the DocumentRoot the full path to the folders...and now i got no errors, just notices on quit and start of the server.
But still it uses the teamfox domain ... mmmm...
dunno what i should check next ?
BTW:
Thanks for helping me on this matter !!
-
Hi,
I get just one line of norwegian from dreamcore and some page from teamfox
Musicman
-
Webmaster
ehm omg !! It fixed it itself ... hahaha !!
This is soo typical .. dunno what was wrong...just decided to work all the sudden... well...YES !!! Now it is working...
puhh...
thanks for all your effort guys really appreciate it ! And learnt some new stuff as well
-
maybe the last one was just the browser cache playing tricks on you...
Musicman
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|