Saturday 15 May 2021

How To Host A Website Using Windows 10

Learn how to host a simple website on Windows 10 using Internet Information Services (IIS). The tutorial will show how to install and setup IIS and how to host a single page website. The tutorial lays the foundations for building more complex websites.


Installing IIS

Installing IIS is trivial, just follow the steps below.

Find and run feature selection

Click the Windows start icon (usually bottom leftmost) and begin typing features. The best match window should appear. Select Turn Windows features on or off. The following image illustrates the idea.

Top

Select features

You should now see the Windows features popup. Scroll down until you see Internet Information Services. Select Internet Information Services. You can accept the defaults and click OK to install. Installation should take less than a minute. The following image shows the default settings on my system.

Top

Check installation

Assuming IIS installed correctly you now have the ability to host your own website. Hosting your own website allows you to try out ideas before committing online. It also allows you to try out different web technologies, PHP, web forms and so on. To test if IIS is up and running on your system try the following.

  1. Open your favourite web browser.
  2. In the address bar type localhost
  3. If all is well you should see a page similar to the following.

Top

Create simple, one page website

The basic test for this step is to see if we can create a simple web page that can be viewed using a web browser. To create a simple website we will create a new directory, add a HTML page and modify IIS settings to ensure that we can view the new web page. Complete the following steps to achieve this.

Create website directory

IIS obtains content from a fixed drive. You can use an external drive, but, for performance a fixed drive is best. Each website you create will typically be created create a new directory. For this example I will create a new folder named, MyWebsite under my root drive, C. The following image illustrates the idea.

Top

Create a simple webpage

Webpages come in all shapes and sizes and may deliver static or dynamic content. For this example we will create a simple, static HTML page. To create the HTML webpage you need a text editor. Notepad will suffice for demonstration purposes, though I wouldn't recommend for more complex websites.

Open notepad, you can do this by selecting the Windows 10 Start menu and typing in notepad. Enter the following text.

<p>Hello, from my new website</p>

Now select save as from the file menu. Be sure to select All Files and then type index.html as the file name. The following image illustrates the idea.

Top

Check progress

At this point you should have a folder, MyWebsite under your root drive (I am using C drive in this example. You should also have an index.html file in the MyWebsite folder. The following image illustrates what you should have.


You should be able to view the index.html file in your default browser. To try, use file explorer to navigate to to C and then to MyWebsite Then select, double-click index.html under the MyWebsite folder.

Top

Setup IIS to host new website

In the previous section we created a simple HTML webpage. Now, we need to let IIS know where our website lives. There are a number of ways to achieve this, for now we will keep it simple and create a virtual directory.

Top

Create a virtual directory

A virtual directory is an alias for a physical directory (i.e. located on your hard disk). A virtual directory becomes part of the web application's URL. For example, the default IIS installation contains a simple web application. You can view the web application by opening a browser and navigating to localhost. We will add a new virtual directory, mysite to the IIS web application. This will allow us to navigate to our simple website using localhost/mysite To do this, perform the following.

  1. Open up IIS (you can do this by typing IIS after selecting Windows 10 Start icon).
  2. Expand the top item under connection until you can see Default Web Sites.
  3. Right click Default Web Sites and select Add Virtual Directory.
  4. Enter website name under alias and browse to where your index.html file resides. The following image illustrates the result on my system.

Top

Test Website

You can now test your new website. Open your favourite web browser, enter localhost/mysite into the address bar and go (pressing enter usually does the trick). If all has gone well you should see the text, Hello, from my new website. The following image illustrates the result on my system using MS Edge.

Top

1 comment: