Setting up IIS on Windows Server
IIS is a web server created by Microsoft. IIS is compatible with Windows Server - that means that you can simply add it as a feature, rather than downloading and installing packages. It also gives you the advantage that you can host .NET applications.
Step 1: Installing IIS
Installing IIS is incredibly simple; in fact, the only thing you have to do is enable it. To enable IIS, go to "Server Manager -> Manage -> Add Roles and Features". Select where you want to install IIS. In the "Select server roles" screen, enable "Web Server (IIS)". Click "Next" to finish the install.
Step 2: Adding sites
Using IIS with multiple sites is very easy. Let's go ahead and add our first site! What you need to do is open the "IIS Manager". This application is where IIS and all sites are managed. You will see all of your servers in the sidebar. Expand your server by double-clicking on its name, then expand "Sites". All sites hosted by IIS are shown here.
In order to add a new site, simply right-click on the screen that appeared and select "Add Website...". Here you will be asked for a number of things: the site name, application pool, physical path, binding, and host name.
The site name can be anything you want. It's up to you what you put there. If you just want to host a website, don't worry about the application pool; you won't need to change it.
The physical path is where the website files are stored. The path for this should be:
C:\inetpub\wwwroot. If you host multiple websites on your IIS server, then add a folder for each website in the
For the binding, select if you're going to use either
https:// for your website. The IP address should be the external IP of your server. IIS will detect that automatically. The port specified is the port that you want to host your website on; usually, this is port 80.
The host name is the domain name for your website. Say that you want to host "http://example.com", you put "example.com" there.
Step 3: Starting and stopping websites
With IIS, you can easily disable websites by "stopping" them. This can be done by going to the website, under "Sites -> Website Name", then clicking "Stop" in the sidebar.
You can "Start" or "Restart" a website in the same fashion.
Step 4: Installing applications
You can upload files from your computer to install a web application. If you want to use a CMS (such as WordPress or Joomla!), then installing it with the Web Platform Installer would be logical. You can compare the Web Platform Installer with Softaculous. Web Platform Installer also allows you to install other applications, such as PHP and SQL Server.
To install an application with the Web Platform Installer, find "Deploy" in the sidebar. Then click "Install Applications From Gallery". You will now be able to search for applications and easily install them by clicking on the "Add" or "Install" button.
Step 5: Setting up authentication
You may only want certain people to have permission to access your website. For this, you can use HTTP authentication. The most popular type of HTTP authentication is "Basic Authentication".
Authentication can be enabled by clicking "Authentication" under "IIS". When enabling basic authentication, users with an account on your server will be able to access your website. Active Directory accounts can be used as well.
By default, anonymous authentication is enabled. This means that authentication is not required.
Step 6: Setting up SMTP email
If you have an application such as WordPress or Joomla installed, they will probably send users some emails. For this to work, we need to setup SMTP. To install SMTP with IIS, go to "Server Manager -> Manage -> Add Roles and Features". You can skip selecting the roles, instead you're going to tick "SMTP server" when it asks you to select the features you want to install.
The icon "SMTP E-mail" will now show up in IIS under "ASP.NET". Here you can set the email address that emails are sent from.
Step 7: Enabling compression
You probably want to enable compression. Compression will make your website faster. To enable compression, simply click "Compression" under "IIS".
Step 8: Using the web.config
If you're used to using the
.htaccess, then you'll need to learn how to use the
web.config file is basically the equivalent of
.htaccess. It provides a lot of the same features, but has a different format.
Step 9: Enabling SSL
In order to enable SSL, you'll need an SSL certificate.
The first thing that we have to do is change the binding of the site from
Click on your server name in the sidebar and click on "Server Certificates" under "IIS". In the sidebar, you will see the option "Import...". Use this to import your SSL certificate.
When you have imported your SSL certificate successfully, right-click on your site name in the sidebar and click "Edit Bindings...". We're going to add a binding. Click "Add...". Instead of
https://. The IP address and host name will be the same; however the port will be set to 443. When you set the site to use
https://, an option called "SSL certificate" will appear. Select your SSL certificate here. Click "OK". When you see the new binding appear, click "Close". Your website now uses SSL.