LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   Accessing Website Being Hosted on Virtual Machine (http://www.linuxquestions.org/questions/linux-server-73/accessing-website-being-hosted-on-virtual-machine-829887/)

Hi_This_is_Dev 09-02-2010 03:10 AM

Accessing Website Being Hosted on Virtual Machine
 
Hi,


I want to access the Website / Web Pages being hosted on the Virtual Machine (Linux) created with Sun VirtualBox onmy Host OS (Windows XP).

The website is working fine on the VM. But I can't access it from the Host OS (Windows XP).

What settings to do I need to configure to accomplish it?

Besides, how can I access the website, being hosted on the Host OS, from within the VM?

What settings to do I need to configure to accomplish it too?

Thanks!

babunix 09-02-2010 04:13 AM

Are you able to do ping from HOST to VM?
Are you able to access other service of VM machine?

What is your network card setting of VM Machine?

Hi_This_is_Dev 09-02-2010 04:30 AM

Connectivity Between Host OS and Guest OS
 
Quote:

Originally Posted by babunix (Post 4085783)
Are you able to do ping from HOST to VM?
Are you able to access other service of VM machine?

What is your network card setting of VM Machine?


I am able to ping and ssh to the VM.

I have not tried accessing any other services yet.

I have set Bridged connection (in the VM Settings) to be able to connect to the VM through ssh and telnet, etc.

kirukan 09-02-2010 05:13 AM

If you can ping to the VM machine, hope can access webserver too, just type & hit in web browser somewhere within your LAN as like http://vm machine ipaddress , please makesure the VM machine firewall allowed the webserver listening port

Hi_This_is_Dev 09-02-2010 07:24 AM

Quote:

Originally Posted by kirukan (Post 4085828)
If you can ping to the VM machine, hope can access webserver too, just type & hit in web browser somewhere within your LAN as like http://vm machine ipaddress , please makesure the VM machine firewall allowed the webserver listening port

I tried that too. But it is not working. Do I need to do any settings related to port? In /etc/httpd/conf/httpd.conf "Listen 80" is already given.

Any settings in that file need to be done?

When I type http://ip-of-vm:80 it is automatically replaced with http://ip-of-vm in the browser, and then website not found error comes up.

babunix 09-02-2010 10:20 AM

As kirukan said check firewall setting and also check selinux if running.

you can check http port responding or not using telnet command.

Code:

debian:~# telnet ip_of_server 80
Trying 10.0.7.234...
Connected to 10.0.7.234.
Escape character is '^]'.

after thar type GET command
Code:

GET
<html><body><h1>It works!</h1></body></html>
Connection closed by foreign host.


sem007 09-02-2010 10:31 AM

You can also use curl to check your web server response

Code:

curl http://www.example.com -v
* About to connect() to www.example.com port 80
*  Trying 192.0.32.10... connected
* Connected to www.example.com (192.0.32.10) port 80
> GET / HTTP/1.1
> User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
> Host: www.example.com
> Accept: */*
....
....


Hi_This_is_Dev 09-02-2010 06:37 PM

Quote:

Originally Posted by sem007 (Post 4086025)
You can also use curl to check your web server response

Code:

curl http://www.example.com -v
* About to connect() to www.example.com port 80
*  Trying 192.0.32.10... connected
* Connected to www.example.com (192.0.32.10) port 80
> GET / HTTP/1.1
> User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
> Host: www.example.com
> Accept: */*
....
....



Thanks for introducing a new command to me!

Hi_This_is_Dev 09-02-2010 06:39 PM

Quote:

Originally Posted by babunix (Post 4086014)
As kirukan said check firewall setting and also check selinux if running.

you can check http port responding or not using telnet command.

Code:

debian:~# telnet ip_of_server 80
Trying 10.0.7.234...
Connected to 10.0.7.234.
Escape character is '^]'.

after thar type GET command
Code:

GET
<html><body><h1>It works!</h1></body></html>
Connection closed by foreign host.


Thanks for showing me how to use telnet and GET.

Hi_This_is_Dev 09-02-2010 06:41 PM

Quote:

Originally Posted by kirukan (Post 4085828)
If you can ping to the VM machine, hope can access webserver too, just type & hit in web browser somewhere within your LAN as like http://vm machine ipaddress , please makesure the VM machine firewall allowed the webserver listening port

Yes, it was Firewalls on both the boxes that were needed to be configured for the services.

Thanks!

Hi_This_is_Dev 09-02-2010 06:44 PM

Hi,


Here is how I solved the problem:

I was able to ping the VM using its IP but not by its host name. I made an entry in the file "c:\windows\system32\drivers\etc\hosts" and voila!

Well, I also enabled "Secure Web Server (HTTPS)", "Telnet", and "FTP" service in Firewall to flag them as a Trusted Services on the VM.

Now I can browse the website on the Host OS.

I have done similar settings in Firewall on the Windows Box also. I also in added an entry in /etc/hosts on the VM to ping the Host OS. Now I can access the website running on IIS within the VM.

So, the problem of accessing website from VM on Host OS and vice versa is resolved! I can also ping both the servers from each end.

Thanks to all of you!


All times are GMT -5. The time now is 10:28 PM.