loading...

Windows Server 2016 – Changing the port on which your website runs

How to use the Docker Compose command

Normally, whenever you access a website, it is running on port 80 or 443. Any normal HTTP request travels over port 80, and the encrypted HTTPS uses port 443. Inside IIS, it is very easy to change the port that a website is listening on if you need to do so. Probably the most common reason to institute a port change on a website is to keep it hidden. Maybe you have an administrative site of some kind and want to make sure that nobody stumbles across it, or perhaps your web server is limited on IP addresses, and you need to turn on another web page but all of your IPs are already running sites. You could utilize a different port for the new site and then have the opportunity to run two (or more) sites using the same IP address, one site on each port.

Whatever your reason for wanting to change the port that a website runs on, let’s walk through the steps to accomplish this task so that it can be one more tool added to your belt.

Getting ready

We have a Windows Server 2016 server online that has the IIS role installed. There is already a website running on this server. Currently, it is using port 80 by default, but we want to change that port to 81 and test accessing it from a client computer.

How to do it…

Here are the steps needed to change your website listener port:

  1. Open Internet Information Services (IIS) Manager from inside the Tools menu of Server Manager.
  1. In the left-hand window pane, expand the name of your web server and click on the Sites folder.
  2. Right-click on your website and choose Bindings….:
  3. Choose the http binding that currently displays port 80 and click on the Edit… button.
  4. Change the Port field to 81. This is just for our example, of course. You could enter any valid port number in this field that isn’t otherwise in use on this server.
  5. Click OK, then Close.
  6. The port is immediately changed on your website. It is no longer listening on port 80. Let’s test this by moving to a client computer on our network and opening Internet Explorer.
  7. Try browsing to the old website address, http://web2:
  8. Whoops! I guess that isn’t going to work anymore. Instead, we need to include our specific port in the URL from now on. Let’s try http://web2:81:

How it works…

We can easily adjust the port that is used to access a website inside IIS by making one simple adjustment. After changing the port number in our website’s bindings, the site immediately changes over to listening on the new port and is no longer active on the old port. Instead of changing the port, you could also add an additional binding into that same screen in order to get the website to respond from multiple ports at the same time. For example, if you wanted your website to run both HTTP for regular access and HTTPS for encrypted access to pages with sensitive information, you could create bindings for both port 80 and port 443.

One note of importance when changing your website port; doing so means your web links for accessing the website will now have to include that specific port number at the end. Also, if you are running firewalls in your network or on the web server itself, it is possible that you will need to adjust settings on those firewalls to allow the new port to be allowed safe passage.

Comments are closed.

loading...