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.

Search for Turn Windows Features On and Off using the search bar: Select the Internet Information Services option: Expand Internet Information Services, and select all the sub-features you require: 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. Search for the IIS application, which will now be available to open on your Windows computer: Open IIS to view the IIS console:

How to Create a Simple Test Website

Create a simple static website using HTML and CSS.

Create a new file called index. html. Add the following content to the file: Simple Test Website

   

This is a test website

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;} 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. Copy or move the index. html and styles. css files into the new MyTestWebsite folder.

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.

In the left-hand sidebar of the IIS console, right-click on the Sites directory. From the options in the menu, select Add Website, to open the configuration window: Add a name to the Site name, such as “My Test Website”. IIS will automatically fill in the field for the Application pool. 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. 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. You can also configure a host name, but leave this blank for now. For the SSL Certificate, select IIS Express Development Certificate. Select Start Website immediately, and click on OK. Highlight the new My Test Website directory in the left-hand column. Click on Advanced Settings, which is in the list of options on the right side of the panel. Under the Behavior section, change the Enabled Protocols option to “https”, and click on OK. 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.

To run your web server, click on Browse *:443 (https) in the right-hand menu. 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. To stop or restart the web server, click on Stop or Restart on the right-hand menu.

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.