How to configure a Web Server within VirtualBox

The point of the project was this, create a web server using VirtualBox and host it on a Windows 7 64-bit platform. And why would I do something odd? Well, I need a copy of Windows 2003 Server Web Edition running on a new platform since the physical PC it was running on literally tore itself to pieces. The drives failed and the cost of buying EIDE drives is just a waste of money.

So why not just upgrade? Well, I will in the future, but I was actually using that machine. I’m familiar with 2003 and had everything dialed in the way I like it. And why host it in Windows 7? That’s the host OS of my most powerful machine, a 6-core machine with 16GB of ram. No sense in rebuilding everything when Windows 2003 Server isn’t multicore aware and only accesses 4GB of ram. But anyway, the OS and the host are sort of irrelevant, it’s the configuration that’s important. So here’s what I did.

First, within VirtualBox, change the networking from NAT to BRIDGED ADAPTER. Select the physical network adapter you want your host machine to connect to. If you have more than one network card, pick which one you want the Guest OS using. My machine has both wired and wireless NICs. I set VirtualBox up on the Wireless NIC.

image

Second, pick the Virtual network card you want the guest OS to emulate. I chose the Intel Pro/1000 MT.

Third, boot the Guest OS and change the IP address of the virtual machine to the same IP address as your internal network. By default VirtualBox using 192.168.56.1. You Guest machine will probably have a similar address. Change it over to the same IP range as the guest machine, something like 192.168.1.xxx. For example, my host is 192.168.1.100 so the guest is 192.168.1.101. You need to give it a static IP address so you can set the Port Forwarding on your Router.

image

Fouth, set Port forwarding on your router. Send traffic destined for port 80, 21 and whatever else you like (such as RDP) to the internal address of the Guest machine. Again, if the Guest is 192.168.1.101 then forward the traffic to that address. DON’T send anything to the VirtualBox network address of 192.168.56.xxx.

image

Finally, make sure to DISABLE all POWER MANAGEMENT functions of both the HOST and GUEST OS. And not just for the machine and hard drives. Make sure you turn it off for the Network Cards. Your Server OS probably doesn’t have anything, but the Host might. My Windows 7 machine had Power Management turned on for both NICS. Disable that or your web server won’t get any traffic. For Windows 7 – Control Panel – Power Options – Change When the Computer Sleeps.

For the network card, Control Panel – Network and Internet – View Network Status and Tasks – Change Adapter Settings – Pick the BRIDGED ADAPTER you selected in VirtualBox, Right Click and choose Properties – Click Configure for the networking device itself. Click the Power Management tab to turn off any power saving options.

image

image 

That should be it. I now have Windows Server 2003 on the live web and it loads PHP, HTML and ASPX pages just fine. In fact, it’s faster than it ever was on the old hardware. Now I can load Windows Server 2008, configure it within it’s own VirtualBox, load all the correct modules and make the switch when I’m ready. Plus, I can have a standby server by making a copy of the VHD files.

This is specific to Windows 7 and Server 2003, but the concept is the same. You need to configure a BRIDGED APAPTER and configure a STATIC IP ADDRESS in the Guest OS. From there, you should have it all set.

Other articles of interest:

2 Responses to How to configure a Web Server within VirtualBox

  • venkat says:

    Hi,

    I had set up windows server 2003 in my windows 7 with bridge network connection. I have used dnsafraid to configure my ip. The problem i am facing is that when i hit my domain name say http://www.abc.com on the browser the page that is being displayed is my router entry page http://192.168.1.1/ and it prompts for username and password. I had also configured nat – virtual server in my router page as follows. NAT — Virtual Servers Setup as follows. Pls help me with this issue. The ip of my windows server within the lan is set to 192.168.1.4. Can u help me find out the mistake i am doing while configuring i have been trying for about a week. pls help me.

    Virtual Server allows you to direct incoming traffic from WAN side (identified by Protocol and External port) to the Internal server with private IP address on the LAN side. The Internal port is required only if the external port needs to be converted to a different port number used by the server on the LAN side. A maximum 32 entries can be configured.

    Server Name External Port Start External Port End Protocol Internal Port Start Internal Port End Server IP Address Remove
    Webserver2003 80 80 TCP/UDP 80 80 192.168.1.4

    • Don Pedro says:

      It sounds like the port forwarding isn’t set up correctly on the router itself. You’re making it to the inside network but the traffic isn’t being sent to VirtualBox. There should be something in the router that sends your HTTP traffic to the correct IP address of your Virtual Machine.

Leave a Reply

Your email address will not be published. Required fields are marked *

Recent Comments
  • Working with Dates and Date Formatting in Katalon Studio (4)
    • Don Pedro: import groovy.time.TimeCategory currentDate = new Date() println currentDate use( TimeCategory ) { after30Mins = currentDate + 30.minutes } println after30Mins https://stackoverflow.com/ques tions/21166927/incrementing...
    • ricky julianto nugroho: hay can u gave me an example for plus a hour in the time ? example : now is 15 pm i want to print 16 in the text thank you
    • Don Pedro: formattedDate=mydate.format(&# 8220;MMM”) – Nov formattedDate=mydate.format(&# 8220;MMMM”) – November
    • Ann: This was a huge help. Thank you ! Do you have something for capturing the month spelled out? and abreiveiated? Example November Nov Thanks !
  • Boostnote for Code Snippets (1)
    • Manual: Hi Don, Regarding the code snippets and examples that you have created. Is there any GitHub repo or something that can be shared? Thanks
  • Using TypeIt4Me with Katalon Studio (3)
    • Manual: That’s great thanks for sharing.
    • Don Pedro: Added a screenshot to show some examples of how I have shortcuts configured for Groovy code. TypeIt4Me supports groups, so you can create shortcuts related to Groovy, Selenium, and other topics to keep them organized. You can...
    • Manual: Hi Don, I like the idea of using the TypeIt4Me for scripting test code. Could you please share how I can create. I also like the idea of creating code templates to use with code editors. Thanks, Manual
  • Another success with Katalon Studio (2)
    • Don Pedro: Since Katalon is free, a very practical demonstration of what it can would be to create the code needed to fill in forms. That was one of my first tasks as Katalon could fill in a lengthy form in seconds versus the minute or...
  • How To Disable the Quicken Registration Prompt (18)
    • Susan Long: I have Quicken personal 2012 which I only use to enter and retrieve data. It suits my needs perfect. Now they have blocked my access and want me to re register. I don’t want to upgrade as it I am comfortable with this...
    • Stewart: I have been using Quicken 200 basic since it was introduced but I now have a new PC using windows 10 and can’t get rid of the registration prompt. I have tried the above control/shift trick but to no avail. Any ideas
    • Dave: Works for Quicken 2007 too. Thanks, Gina!
    • Charlie Fellenbaum: Yay, thanks, and that worked for Quicken 2006 as well.
  • Conditional Statements – IF .. ELSE IF in Katalon Studio (1)
    • Allyson: I used this : elementVisible=WebUI.verifyEle mentPresent… but it failed because “FAILED because (of) Unable to verify object ‘Object Repository/Homepage/b_vaolopho c’ is present (Root cause:...
  • Quasi Performance/Load Testing with Katalon Studio (1)
    • Anthony: I have done this with 100 plus machines at the same time and it worked well and provided some useful feedback.