logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

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.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Accessing a host running on a VM
Author
iconofsin



Joined: 25 Jul 2014
Posts: 1

PostPosted: Fri 25 Jul '14 21:40    Post subject: Accessing a host running on a VM Reply with quote

I have an Apache server running on a virtual machine and I want to be able to access the pages it serves from a browser running on the host OS.

I am using OracleVM virtualbox as my VM platform.
I am using windows 7 as my host OS.
I am using ubuntu as my guest OS.

I have managed to set up a virtual host so that it works from browsers running in the guest OS (ubuntu)
But I cannot get it to serve these pages to a browser running in the host OS windows.

The config file in the apache2/sites-available and apache2/sites-enabled has the following config for the virtual host I am trying to access.


<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName testsite
DocumentRoot /var/newserver
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/newserver/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

</VirtualHost>


Note that this config is a copy/paste of the default local host config which Apache is installed with, only the root directory and servername have been changed so it is definitely a valid config.

The hosts file on ubuntu has the following

127.0.0.1 localhost
127.0.1.1 sam-VirtualBox
127.0.0.1 testsite


As I said this setup allows for browsers running on the guest OS to access the site.

My VM platform creates a virtual network interface between the two systems, this appears in windows list of network interfaces.

I have tried adding the IP address for this interface to the windows 7 hosts file

ie xxx.xxx.xxx.xxx testsite

But it is not working.
The Apache config file has <VirtualHost *:80> so Apache should serve the site no matter what IP the request comes from. And the windows Hosts file has the same reference to the site (with a different IP) that the Ubuntu hosts file has

So why cant my windows browsers access the site?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Sat 26 Jul '14 18:55    Post subject: Reply with quote

Set the network to private network or bridged. The default setting (NAT) does not allow access the guest OS from the outside.
Back to top


Reply to topic   Topic: Accessing a host running on a VM View previous topic :: View next topic
Post new topic   Forum Index -> Apache