WHAT & WHY:
As a developer many time you may wish if you could run your static HTML website locally on your computer (Windows 7, Windows Vista, Windows XP, Windows 2008).
Although with Static website, you could easily download and double click the index.html or home.html file to open and run other pages. But this will not give you the real world senario. For example you will not able to use a path like /images/home-page-banner.jpg. You will have to use a relative paths like ../images/home-page-banner.jpg.
Following are very easy steps to do so. These steps are for Static HTML website. I will also post steps for more advance websites that uses ASP, ASP.NET, Dotnetnuke etc and uses database server.
WHAT YOU NEED:
1. IIS Server installed on your local machine
2. FTP username, password to download files form your FTP server
3. Administrative rights on local machine. Many task will display messages requesting Administrative privilege to run the task.
1. Download files form Web Server
2. Installing IIS Server
3. Configuring website in IIS server, Add DNS in local Host file
3. Running the site
1. Downloading Files From Web Server
1. Download & Install an FTP Client. I like FileZilla which could be downloaded from http://sourceforge.net/projects/filezilla/
2. Open Filially & Site Manager using Menu File->Site Manager.
You will need FTP Host address, Username, password. You will need to login to your hosting account to find these 3 information or call customer service.
3. After entering about details click Connect. FTP will be connected and you will see few boxes in the FileZilla.
Top box for connection status and error messages
Left side box will display your computer files just like Windows Explorer while right side box will display your web server files.
4. Create a folder in your local machine (lets say c:\LocalWebsite)
5. In the right side window, select all folder & files inside htdocs folder. You can do this by selecting htdocs in upper box (folder view) and then press CTL+A in the lower box (folder & files view)
6. Drag & Drop all the selected files from right side lower box to left side lower box. TAKE ALL PRECUATIONS during this step and DO NOT drop folders & files any ware else then the left side lower box. It will take few min to few hours depending upon the size of your files over web server.
2. Installing IIS Server
Windows XP –>
1. Start –> Control Panel –> Click at Add or Remove Programs.
2. Click Add/Remove Windows Components. This will display The Windows Components Wizard.
3. Follow the Wizard to install IIS (Will post screenshot if needed. Let me know via comment)
Windows Vista, Windows 7 –>
1. Start –> Control Panel –> Click at Programs and Features
2. Click at Turn Windows feature on or off in the left side bar
3. This will display the Windows features screen. Select Internet Information Services, World Wide Web Services and few other checkboxes as shown in following screenshot. for the current task you don’t need most of them but I anyways shows you what I normally select.
Windows 2008, Windows 2008 R2
Follow the steps listed in my other post –> Windows Server 2008 - Add Role - Web Server IIS
Configuring website in IIS server, Add DNS in local Host file
Adding DNS in local Host file
1. Open Notepad using Run As Administrator Option and then open your local host file which is located at C:\Windows\System32\drivers\etc\hosts.
2. Enter the DNS entry for your local website and save. Following are some sample DNS names
Configure IIS – Windows Vista, Windows 7
1. Open IIS Server: Start –> Control Panel –> Administrative Tools –> Internet Information Services (IIS) Manager
2. In the IIS expand the left side tree –> select Sites –> Right Click –> New Site. It will display Add Website screen. Enter the name you have added in the Host file
3. Click Ok
Running The Site
1. Open IE, Firefox Or Google Chrome
2. Type the DNS name that you enter in your local Host file and used when creating IIS website
3. Your website should comeup. You can make changes in files located at c:\localwebsite folder to try.
Remember to open Notepad using Run As Administrator Option and then open your local host file.