Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Virtual host problem |
|
Author |
|
rugzmsk
Joined: 29 Jul 2014 Posts: 2
|
Posted: Tue 29 Jul '14 14:16 Post subject: Virtual host problem |
|
|
Hi
I'm a newbie with Apache and just start trying to set up a test server. The problem is that I can't open http://mysite.local.
I've made an index.html for mysite.local but each time I was trying to open that page it failed. Also http://localhost redirects to index.html (which I create).
I use: Apache 2.2 (httpd-2.2.25-win32-x86-openssl-0.9.8y.msi)
Windows Server 2003 (virtual machine)
Here is the mysite.conf: http://apaste.info/cw5
And additional code for httpd.conf:
Code: | # www.mysite.local
NameVirtualHost *:80
Include "C:/Apache/conf/mysite.conf" |
Also, when I'm restarting the Apache with CMD it says: Quote: | C:\Documents and Settings\Administrator>httpd -k restart
httpd: Could not reliably determine the server's fully qualified domain name, using 10.0.2.15 for ServerName |
I would be happy if someone could help me to figure out why I can't open http://mysite.local and why http://localhost opens index page for mysite.local....
Thanks in advance! |
|
Back to top |
|
AdrianK_IT
Joined: 30 May 2013 Posts: 34 Location: Scottish Borders, UK
|
Posted: Tue 29 Jul '14 23:02 Post subject: |
|
|
Hi rugzmsk
The simple answer to your query is that you need to add an entry to your hosts file:
127.0.0.1 mysite.local
However, your query puzzles me. You don't really seem to be setting up virtual hosts, rather one host on a virtual machine. These are not the same. Or have I misunderstood?
I think you need to give more details of your httpd.conf; the 'cmd' issue must relate to errors there.
I also don't believe that NameVirtualHost *:80 has any place or meaning in httpd.conf. |
|
Back to top |
|
rugzmsk
Joined: 29 Jul 2014 Posts: 2
|
Posted: Wed 30 Jul '14 8:09 Post subject: |
|
|
AdrianK_IT wrote: |
127.0.0.1 mysite.local
|
Hi AdrianK_It, thanks for your reply.
I have this entry in my host file, but it still doesn't work.
The httpd.conf file is like "from the box" (http://apaste.info/y60) I add only last three lines there.
I'm not sure about NameVirtualHost *:80 because as I said before I'm a newbie. This Directive from video tutorial, but in video everything works as it should. I've rechecked each line of code more than 10 times
Is it possible that something wrong with DNS server?
https://www.dropbox.com/s/6pc6b0og5kmkpdq/dns.JPG
ADDED:
OMG I just start the VirtualMachine today's morning and try to reach http://mysite.local or http://www.mysite.local - it opens. I have no idea what was wrong, because I didn't do anything to configuration, just shut the VM down.
Anyway thanks for reply! |
|
Back to top |
|
AdrianK_IT
Joined: 30 May 2013 Posts: 34 Location: Scottish Borders, UK
|
Posted: Wed 30 Jul '14 10:50 Post subject: |
|
|
Hi rugzmsk
That it's working on restart is probably because the DNS cache was flushed. You can do this manually if/when you add further entries to your hosts file, by typing at a command prompt:
ipconfig /flushdns
You do not seem at present to be actually running a 'virtual host' (though you may have plans to do so). In which case, it would be more logical to add these lines from your mysite.conf file:
ServerName www.mysite.local
ServerAlias mysite.local
ServerAdmin webmaster@mysite.local
ErrorLog "C:/Apache/logs/error.log"
CustomLog "C:/Apache/logs/access.log" common
DocumentRoot "C:/Apache/htdocs"
<Directory "C:/Apache/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Order deny,allow
Allow from all
</Directory>
directly into httpd.conf, deleting the lines:
NameVirtualHost *:80
Include "C:/Apache/conf/mysite.conf"
Also comment out:
ServerAdmin user@company.ru
Giving an explicit server name in httpd.conf should solve the 'cmd' problem. |
|
Back to top |
|
|
|
|
|
|