Monday, October 14, 2013

How To : Install IIS and Create Two Sites

Now we have everything set up for Apache, and it's all working fine, But what happens if you decide you want to run an IIS server with ASP.NET? Well then you need to install IIS.

What is IIS? Internet Information Services (IIS) is an extensible web server created by Microsoft for use with Windows family. Unfortunately IIS is not available on Home Edition operating systems, so you'll need Professional + to run it locally.

Now lets install IIS. Since it comes already available on any computer running a Professional version of a Windows operating system there is no need to download anything.

To start the installation, open your start menu and type "Programs and Features" in the search bar.

Click the Programs and Features item.

Once in the Programs and Features page, click Turn Windows features on or off located on the left hand side of the window.




After clicking the item, a new popup will appear.



We are looking for the item Internet Information Services. Click the box next to it (it will show as clicked when there is a square inside the block)

Once the box is clicked (don't open it and click anything else.... yet ;) ) Click OK

A popup will appear tell you it may take a while and to wait patiently. Just wait for it to finish ;)

When finished you will be able to turn on your IIS. **

** Please note : If you have Apache installed and running on port 80, you will need to turn Apache off before running your IIS server.

After turning your apache server off, we need to turn on our IIS server. To do that we need to open the start menu, and type IIS in the search bar.

Click the Internet Information Services Manager and let it open. When it opens you should see the following :



Notice how Start is grayed out underneath Manage Server? This is because the server is already running.

Notice how under the Sites dropdown - Default Web Site isn't turned on? (it has a square in the circle on the picture which means it is not running). To turn your site on, select your site, and on the right hand side ( where manage server is currently on the screenshot above) you should see the option to Start your site. Click it.

Now if everything is set up right (what set up? We didnt do any for IIS :S ) and Apache was turned off, you should see the following when you type localhost  in your browser :



Now that's nice and working well.... but how do we create our own sites ?

Well to create a new site, all we need to do is right click the Sites option that we opened up on the left hand side earlier ( the dropdown ) and click Add Web Site.

After you click add website a new pop up will appear.



In the Site Name field, enter the name of the site you wish to create. Im going to use myfirstphp.tbd for the first one.

In the Content Directory section, browse to where the new site will be ***

*** It is important to note that IIS has a different root directory then Apache. For IIS the root web directory is in C:\inetpub\wwwroot, so make sure all IIS sites go inside there (You may have to make a new folder) ;)

In the Host Name  section, enter the URL you wish to associate it with. In this example I will be using myfirstphp.tbd .

Leave everything else the same and click OK

Do this for a second website, and when done you should have a total of three websites. The Default website and the two we just created. It should look like :



Now to test your sites, we need to create some test files. In the first site lets make the following
page :

index.html

         Code:
<html><body><p> This is my first site </p></body></html>

Create this file on your desktop, and drag and drop it to your site. Do this for the second site as well, except change the text in the paragraph.

Now Lets test it out. Go to your browser and type in your first site. You should see a similar message to :





If you changed the messages, they will be different of course ;)

Congratulations, you have now installed IIS and created two new sites.

Stay tuned for my next post on How To : Install ASP.NET

Thanks for reading !



No comments:

Post a Comment