If you’re creating a website, you’ll probably want to test it before hosting it on the internet to ensure it works properly.

Ideally, you should test your site on the same web server that it will run on when you go live. This allows you to be sure that your site will behave in production the same way it behaves locally. Fortunately, most web servers are easy to install and use on your local computer.

On a Windows PC, you can use Internet Information Services (IIS). IIS comes free with Windows, so all you need to do is enable and configure it to view your website.

What Is Internet Information Services?

IIS is a web server that you can use to host static or dynamic websites. A web server works by serving content—such as HTML, JavaScript, or media files—to a user’s browser, in response to a request.

Some frameworks such as Angular already have basic built-in web servers. These will serve your website to preview and test locally, using the localhost domain. However, there are some scenarios where you need to set up a full-blown web server yourself.

One example of this is when publishing a scene from a Unity project. You are likely to get an error if you try to open the index.html file directly in your browser, without a web server running. In this case, you could store your Unity WebGL files in IIS, and run them on the server.

How to Enable IIS

Enable IIS using the Turn Windows Features On and Off menu on Windows.

  1. Search for Turn Windows Features On and Off using the search bar:
    Turn Windows Features on or off in the search bar
  2. Select the Internet Information Services option:
    IIS enabled in Turn Windows Features on or off menu
  3. Expand Internet Information Services, and select all the sub-features you require:
    IIS enabled in Turn Windows Features on or off menu
  4. Click OK, and wait for Windows to apply the new changes. In the future, if you decide to remove or change any features, Windows may ask you to restart your computer before applying them.
  5. Search for the IIS application, which will now be available to open on your Windows computer:
    Searching for IIS in the Windows searchbar
  6. Open IIS to view the IIS console:
    IIS Console

How to Create a Simple Test Website

Create a simple static website using HTML and CSS.

  1. Create a new file called index.html. Add the following content to the file:
            <!DOCTYPE html>
    <html lang="en-us">
    <head>
     <title> Simple Test Website </title>
     <meta content="text/html; charset=utf-8" />
     <link rel="stylesheet" href="styles.css">
     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"> </script>
     <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"> </script>
    </head>
    <body>
     <div class="nav">
       <nav class="navbar navbar-inverse nav">
         <div class="navbar-header">
           <a class="navbar-brand" href="#"> Website </a>
         </div>
         <ul class="nav navbar-nav">
           <li class="active"> <a href="#"> Home </a> </li>
           <li> <a href="#"> About </a> </li>
           <li> <a href="#"> Contact </a> </li>
         </ul>
       </nav>
     </div>
     <div class="container">
       <h1> This is a test website </h1>
     </div>
    </body>
    </html>
  2. Create a new CSS file called styles.css. Add the following styling to the file.
            * {
       font-family: sans-serif;
    }
     
    .nav {
       border-radius: 0px !important;
       color: white;
    }
     
    .link {
       margin-right: 10px;
       font-size: 12pt;
    }
     
    .brand {
       margin-left: 20px;
       margin-right: 40px;
       font-size: 18pt;
    }
     
    .container {
       text-align: center;
       padding: 40px 20px;
    }
  3. Create a new folder in the C:\inetpub\wwwroot directory on your computer, called MyTestWebsite. This folder is specifically used for storing the web pages and other content that make up your website.
  4. Copy or move the index.html and styles.css files into the new MyTestWebsite folder.
    File Explorer opened showing test website files

How to Add and Configure Your Website Using IIS

To host your website using IIS, create a new website and point it to your content.

  1. In the left-hand sidebar of the IIS console, right-click on the Sites directory.
  2. From the options in the menu, select Add Website, to open the configuration window:
    Right click on Sites folder showing Add Website option
  3. Add a name to the Site name, such as "My Test Website". IIS will automatically fill in the field for the Application pool.
    Input field to add a website name
  4. Add the physical path, which is the location where you have stored your website files on the computer. Click on the three dots to select a folder. From the menu, navigate to the MyTestWebsite folder, under the C:\inetpub\wwwroot directory.
    Input field to add physical path to where website files are stored
  5. Select https as the Type. The default Port for HTTPS is 443, but you can change the port to something else if that’s currently in use.
    Type and Port in IIS Settings
  6. You can also configure a host name, but leave this blank for now.
  7. For the SSL Certificate, select IIS Express Development Certificate.
    Default SSL Certificate selected
  8. Select Start Website immediately, and click on OK.
  9. Highlight the new My Test Website directory in the left-hand column.
  10. Click on Advanced Settings, which is in the list of options on the right side of the panel.
    IIS panel with Advanced Settings on the right
  11. Under the Behavior section, change the Enabled Protocols option to "https", and click on OK.
    Enable Protocols set to https
  12. If you want to edit these details at any point in time, you can click on the Basic Settings or Advanced Settings options in the right-hand menu.

How to Stop, Start or Restart Your Website on the Web Server

To start your web server and view your website, click on the Browse option in the right-hand menu. You can also restart or stop the web server at any time.

  1. To run your web server, click on Browse *:443 (https) in the right-hand menu.
    IIS Panel with Browse 443 option on the right-hand side
  2. Your website should now be running on the web server. You can access it via the URL https://localhost/. If you receive a warning about your site connection not being secure, you may have to use a different valid SSL certificate. You can find good documentation from Microsoft on how you can create a new SSL Certificate and use it in IIS.
    Preview of test website in the browser
  3. To stop or restart the web server, click on Stop or Restart on the right-hand menu.
    Stop Start and Restart options in the IIS panel

Hosting a Website Using IIS

Local testing is an important part of any development cycle, including when you’re building a website.

You can host your website locally using the Internet Information Services (IIS) web server. You can use it to host any static website (such as a standard HTML or CSS site) or dynamic website (such as an ASP.NET site).

There are various options you can choose from when hosting your website online. If you are hosting a simple website, you could store your website files on Dropbox, Google Drive, or One Drive, before hosting them.