Let's say you have two websites in IIS, one called www.example.com and the other called qa.example.com. www.example.com will use ports 80 and 443. To be able to connect to qa.example.com, we need to use a different port. Follow these steps to change the default port in IIS:
- In IIS, expand the root directory and expand Sites
- Right click on qa.example.com and select Edit Binding
- In the Site Bindings dialog box, select the binding and select Edit
- Change the port from 80 to any other port number, such as 8080 and select OK
- In the right panel of IIS, select Restart to restart the website
The port will need to be opened in the router and Windows Firewall:
The following command will need to be run with administrative priviledges:
netsh http add urlacl url=http://<your ip address>:8080/ user=everyone
The port will need to be added to the applicationHost XML file.
- Navigate to C:/Windows/System32/inetsrv/config
- Open the file applicationHost in Notepad
Note: Do not use Notepad++. Notepad++ is a 32-bit application, and Windows Explorer is a 64-bit application, which is why Notepad must be used.
- In the applicationHost file, locate the section that lists the bindings, and add the following:
<binding protocol="http" bindingInformation="*:8080:<your ip address>" />
Note: Do not enter
<binding protocol="http" bindingInformation="*:8080:*" />.
- Save the changes, and close Notepad.
To test this, go to http://qa.example.com:8080 and the default page of qa.example.com should be displayed. Do not use the IP address, such as http://192.168.0.3. IIS needs to get the name of the website. If a problem occurs, view the IIS log files at C:/inetput/logs/LogFiles/W3SVC1/.