apache virtual host problem - webmin
Hello,
I set up additional virtual hosts on my machine through webmin apache but the default domain name points to the first virtual host. Do I have to set up a default virtual host and point it to the default directory or is there an error happening. Thanks Reed |
Hi
I'm trying to learn apache myself, but haven't tried the 'virtual host' settings. I sorta did it the easy way by creating symlinks from the doc root dir to the various users dir. Dunno if there are security issues against doing it this way, but i found it pretty easy :) In my server doc root dir ( /www/html ) i made the symlinks like: ln -s /home/user1/html user1 This makes a symlink called 'user1' that points to user1's html directory. The url would then be: www.whatever.com/user1 |
hi- i'm having exactly the same problem. i have set up a number of virtual hosts, restarted apachectl etc. etc. and nothing happens- every domain points to the default virtual host. Here are the details from the httpd.conf file:
NameServer xxx.xxx.xxx.xxx:80 (an ip address) and each virtual host takes the form: <VirtualHost xxx.xxx.xxx.xxx> ServerAdmin webmaster@xxxxxx.co.uk DocumentRoot /usr/local/apache/htdocs/xxxxxx ServerName www.xxxxxx.co.uk ServerAlias xxxxxx.co.uk *.xxxxxx.co.uk ErrorLog logs/xxxxxx.co.uk-error_log CustomLog logs/xxxxxx.co.uk-access_log common </VirtualHost> do i have to use the gateway IP address of the machine or something? also- does it matter that the domain(s) pointing to the machine are pointing to an ip address rather than a name. it is getting supa frustrating now! cheers for listening- hope someone answers... |
As i'm pretty new to apache myself, i'm not sure this will help, but... I believe i read an example file on virtual severs somewhere, and as i remember it each virtual server was given a different port. Something like <VirtualHost 1st.server.ip.adr:8001>
</VirtualHost> <VirtualHost 2nd.server.ip.adr:8002> </VirtualHost> Dunno if this helps, just a thought :) |
reedsmith: Yes, you must set up a default VirtualHost. Any domain name that resolves to your IP and is not listed in a VirtualHost directive will default to the first one listed. This caused me some embarassment when I was hosting a small business and when my client left the www off of his URL, it defaulted to the first VH on my server, which happened to be a porno site! (Which is why you want to add ServerAlias *.domainname.com to each VH directive)
From the Apache docs: Code:
For example, suppose that you are serving the domain www.domain.tld and you Secondly, if you rename the /home/user1/html directory to /home/user1/public_html, then apache will serve the pages there to the URL www.whatever.com/~user1. So you don't need the symlinks. [edit] Or you can change the following section in httpd.conf: Code:
<IfModule mod_userdir.c> Code:
<IfModule mod_userdir.c> bobby sands: I think you need to use the 'NameVirtualHost *' (or 'NameVirtualHost xxx.xxx.xxx.xxx:80') directive, not NameServer xxx.xxx.xxx.xxx:80. Enjoy! --- Cerbere |
Thanx for the info - it really made a few things a bit clearer to me :) All those docs & howto's really can be an information overdose to us not so experienced with linux/apache...
|
All times are GMT -5. The time now is 09:07 PM. |