Launching your first website

Seems like a pretty logical first step; let's get a website started! Actually, you already have one, but it's pretty useless at the moment. As soon as you finished installing the IIS role, a standard website was started automatically so that you can verify everything is working as it should. Now we want to replace that default website with one of our own so that we can make some real use of this new server.

Getting ready

We will be accomplishing all work from our new Server 2016 web server. This one does happen to be domain joined, but that is not a requirement. You would be able to launch a website on a standalone, workgroup joined server just as easily.

How to do it…

Follow these steps to start your first website on this new IIS web server:

  1. Open Server Manager and drop down the Tools menu. Then click on Internet Information Services (IIS) Manager.
  2. In the left-hand window pane, expand the name of your server and click on the Sites folder.
  3. Right-click on Default Web Site and navigate to Manage Website | Stop. This will stop that automatically created website from running and getting in the way of the new website that we are about to create.

    How to do it…

  4. Before we create our new website, we will need to create an HTML webpage file that will run when users browse to the new site. Let's leave IIS Manager open for a minute and switch over to File Explorer. Browse to C:inetpub. This is sort of the home folder that IIS creates and can be a good starting point for building your website. You do not have to create your new page within this folder, you could certainly set one up in another location, or even on a different drive altogether.
  5. Create a new folder called NewWebsite, or whatever you want it to be called.
  6. Inside this new folder, we are going to create a new file called Default.htm. To do this, I usually right-click and choose to create a new text file, and name this file Default.txt. Then I either adjust Folder Options so that I can see and modify file extensions, or I simply open up a Command Prompt window and rename the file that way. However you do it, make sure that your Default.txt gets changed to Default.htm as the final filename.

    How to do it…

  7. Now edit your new Default.htm file with Notepad or another text editing tool and enter some text. Thankfully, modern web browsers will properly display a page based on some plain text, so that we don't have to input valid HTML code. If you know how to program in HTML, even better, though I doubt you would be reading this particular recipe. Or maybe you have a preconfigured webpage file or set of files from a software installation; you could place those into this folder as well. I am going to simply enter some text in that file, which says, Congratulations, you are viewing our new website!.
  8. Head back over to IIS, and let's get our site rolling. Right-click on the Sites folder and choose Add Website….
  9. Input a site name, which is just a descriptive name for your own purposes to identify the site in IIS.
  10. For the Physical path, choose our new website location, which is as follows: C:inetpubNewWebsite.
  11. If you are running multiple IP addresses on this web server and want to dedicate this new site to only run on a particular IP address, you can choose it from the IP address field. Otherwise, if you are running a single IP or if you want our new site to work on all IPs configured on this system, leave it set to All Unassigned.

    How to do it…

  12. Click OK.
  13. From another computer on the network, open up Internet Explorer and browse to http://<webserver>. For our particular example, we will go to http://web2.

    How to do it…

How it works…

Starting a new website is perhaps the simplest task that can be accomplished in IIS, but it portrays the core functionality of this role. The purpose of running IIS in the first place is to publish websites. It is important to understand the location of this task and the places that you may have to reach inside the filesystem in order to modify or create websites of your own. Not everything is done from within the IIS Management window.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.119.177