Following up from the previous Aha moment post, this is Aha moment 2 and I am accessing localhost on Ubuntu from Windows 7 in VM Virtualbox. I have VM Virtualbox on Ubuntu 10.10 and I installed Windows 7 in this virtualbox. If I tried to access localhost on Ubuntu from a browser in Windows 7, I get an error. So this is how to access it.
The first thing to check is Ubuntu side. Open if you have nothing in /etc/apache2/httpd.conf. If you have any virtual host you need to delete them and restart the apache. If it is clear, then on terminal type ifconfig to check your inet addr.
Mine is following.
eth0 ...
...
...
lo ...
...
...
wlan0 ...
inet addr:192.168.1.2 Bcast ....
Find inet addr. Mine is 192.168.1.2.
Start your VM Virtualbox and Windows 7. Open your browser and type http://192.168.1.2/mysite/.
If your web app is on CodeIgniter, then open system>application>config>config.php and change the following.
$config['base_url'] = "http://192.168.1.2/mysite/";
And it should show your website from localhost on Ubuntu.