Results 1 to 6 of 6
Hi,
I would like to use virtual hosting to redirect each domain I have to a folder on my server.
So I changed the DNS of my domains in order ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 08-27-2008 #1Just Joined!
- Join Date
- Aug 2008
- Posts
- 5
VirtualHost Apache
Hi,
I would like to use virtual hosting to redirect each domain I have to a folder on my server.
So I changed the DNS of my domains in order to be redirected to my server, and that's working.
Now I want to set the virtualhost config to reach the relevant folder for all my domains.
The default configuration of my Gentoo is:
And I've added just after that:Code:<VirtualHost *:80> ServerName localhost Include /etc/apache2/vhosts.d/default_vhost.include <IfModule mpm_peruser_module> ServerEnvironment apache apache </IfModule> </VirtualHost>
But when I want to reach "mysite", I'm always redirected to the root of my server (that is to say, to /home/ovh/www instead of /home/ovh/www/mysite)Code:<virtualhost *:80> ServerName mysite.com ServerAlias www.mysite.com DocumentRoot /home/ovh/www/mysite </virtualhost>
That's as if what I added couldn't be read... I just don't understand why and what I should do to get it working.
Can you help me ?
Thanks a lot.
PS : I apologize for my poor english... I'm french.
- 08-28-2008 #2
you need "name based virtual hosts", google that or search this forum. I know I have helped on several topics about that in this forum, google has good help also.
- 08-28-2008 #3Just Joined!
- Join Date
- Aug 2008
- Posts
- 5
Thanks Jledhead.
I searched google and this forum (all threads having "virtual host" or "virtualhost" in the title), and I found many threads about the issue I deal with.
I found many threads with no answer like this one and some others with many answers but not explaining how to fix the problem (like this one).
But absolutly none of them explain what to do if your configuration always chose the default virtual host (the first), instead of the one matching to the hostname typed.
So the issue is that when i type 'mysite.com' in the URL bar, I'm driven to the path of my default virtual host instead of the path of the virtual host with the lineIf someone having already dealt with that could help, I'm sure that it would help more than one person.Code:ServerName mysite.com
Thanks a lot
- 08-28-2008 #4
so did you read my post. i didn't say search for virtual host, I said search for name based virtual hosts (its different, thats why I said it)
name based virtual host - Google Search
http://www.linuxforums.org/forum/sea...archid=1291289
- 09-01-2008 #5Just Joined!
- Join Date
- Aug 2008
- Posts
- 5
I did it too... That was my redirection that was not set correctly. I had not chosen to redirect the hostname by changing DNS (there was an other choice in my OVH manager).
So the configuration above was OK.. So if you're reading this post and if you don't understand why your configuration doesn't redirect your websites in your directories proprely (and if you have checked that your configuration files are correct), have a look to your DNS configuration ! Just check that the target of the field "A" is the IP adress of the server you want to redirect hostnames to.
For OVH users : Be careful to change the DNS of your hostnames, and not to chose the option "Redirect website", for this one will just build a page with a frame containing the home page of the root of your server.
Once again, I apologize for my 'frenglish'.
- 09-01-2008 #6Just Joined!
- Join Date
- Sep 2008
- Posts
- 3
This is the Virtual-Domain-Conf for my Home-Server (Windows, XAMPP):
On Windows add also in %WINDOWS%\system32\drivers\etc\hosts the following:Code:NameVirtualHost 127.0.0.1 # Deninition of Virtual-Domain 1 (www.domain.tst): <VirtualHost www.domain.tst:80> ServerName www.domain.tst DocumentRoot "Drive:/path/to/htdocs" <Directory "Drive:/path/to/htdocs"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> # Deninition of Virtual-Domain 2 (www.domain2.tst): ... (same as above with dofferent domain-name
Since this is a Home-Server i don't looked at security and several options in the configuration of Apache.Code:127.0.0.1 www.domain.tst


Reply With Quote

