Hi Guys,
Have a question regarding Apache Webserver. I've been reading some tutorials, and already know how to setup Webservers.
So far have done this scenario
Sample Scenario 1: Simple Webserver (IP 10.0.0.2
- install apache packages
- create
index.html file on directory
/var/www/html/
- run apache by typing service httpd restart
- testing ok, using command
links 10.0.0.2 or
links localhost or browsing
http://localhost
Sample Scenario 2: One IP Address and two domain servers (
www.domain1.com and
www.domain2.com)
- edit file
/etc/httpd/comf/httpd.conf then add entries below
NameVirtualHost 10.0.0.2
<VirtualHost www.domain1.com>
ServerAdmin admin@domain1.com
DocumentRoot /var/www/html/domain1.com
ServerName www.domain1.com
Error log/domain1.com-error.log
CustomLog logs/domain1.com-access_log common
</VirtualHost>
<VirtualHost www.domain2.com>
ServerAdmin admin@domain2.com
DocumentRoot /var/www/html/domain2.com
ServerName www.domain2.com
Error log/domain2.com-error.log
CustomLog logs/domain2.com-access_log common
</VirtualHost>
- then create index.html on both domain2.com and domain1.com directorys
- start httpd server
- Testing was ok, by using links command on
www.domain2.com and
www.domain1.com
Now my main question is that, when I've done the said 2 scenario on one server. I can browse
www.domain2.com and
www.domain1.com, but when I try browsing from a remote computer
http://10.0.0.2 or
http://localhost. it points to the index.html file on
www.domain1.com?
My thinking, when I browse from a remote server it should be like this
1.
http://10.0.0.2 ---> output display should be on /var/www/html/index.html
(does not work instead it points to the directory /var/www/html/domain1.com/index.html????)
2.
http://www.domain1.com --> output display will be on /var/www/html/domain1.com/index.html (no problem)
3. http>//www.domain2.com --> output display will be on /var/www/html/domain2.com/index.html (no problem)
Please help.. I'm a bit confused with this...
Regards,
Gudl4sh25