Author |
|
Clintonb
Joined: 29 Sep 2010 Posts: 2
|
Posted: Wed 29 Sep '10 22:41 Post subject: working virtual host? |
|
|
I have been trying for a few days to create a virtual host with apache but i cannot get it to work despite reading all the config files on the internet. I have correctly edited my hosts file and my hosts file has been confirmed as working using ping www.test.com in the command line. I have removed the comment to include the vhosts config file and i have tried setting up the virtual hsot information but nothing i seem to try is working. Has anyone gotten virtual hosts to work on localhost? Could you please save my sanity and send me a copy of a working config files so i can see where i'm going wrong. |
|
Back to top |
|
wm003
Joined: 24 Mar 2006 Posts: 88
|
Posted: Thu 30 Sep '10 10:03 Post subject: |
|
|
This works fine for me
Code: | NameVirtualHost *:80
<VirtualHost *:80>
ServerName localhost
DocumentRoot "c:/programme/Apache Group/Apache2/htdocs/wwwroot"
</VirtualHost>
<VirtualHost *:80>
ServerName yourcomputername
# set ajax1-yourcomputername to 127.0.0.1 into your local hosts-file
ServerAlias ajax1-yourcomputername
DocumentRoot "c:/programme/Apache Group/Apache2/htdocs/wwwroot/anothervhost"
ErrorLog "logs/anothervhost/error.log"
CustomLog "logs/anothervhost/access_%Y-%m-%d.log" common
</VirtualHost> |
|
|
Back to top |
|
Clintonb
Joined: 29 Sep 2010 Posts: 2
|
Posted: Thu 30 Sep '10 23:42 Post subject: Operating system. |
|
|
I've used the exact same config settings for my virtual host and when i try and load from that domain, it just opens up the bing.com page. What operating system are you running because i'm using windows 7 and i'm starting to think that windows is preventing this from working for some or other reason. I thought it strange becaues i backed up all the config files i used on windows xp and those config files worked fine back then but now all of a sudden it's no good. |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Fri 01 Oct '10 1:10 Post subject: |
|
|
Does http://localhost work?
What is in your hosts file
are you using an editor run as administrator? |
|
Back to top |
|
wm003
Joined: 24 Mar 2006 Posts: 88
|
Posted: Fri 01 Oct '10 11:20 Post subject: |
|
|
- localhost works fine
host:
Code: | 127.0.0.1 localhost
127.0.0.1 ajax1-yourcomputername
|
Yes, you should open that file with admin privileges |
|
Back to top |
|