Posts Tagged ‘iis’

Getting started with IIS part 2

Sunday, September 16th, 2007 | Life, Tech

Make sure you read part I before enbarking on this second entry. For those of you who have read part I and are wondering what do I do next? Read on…

Virtual Directories

That is everything you need to know for customising the root directory. But that’s just the properties options. Next we are going to create a directory so that the folder ‘work’ will be mapped to a completely different directory. First close the properties box and bring to focus the Management Console if it isn’t already. Then find the root icon again. Now right click it and hover over the new > link. This should bring up a new link with an option that says ‘virtual directory.’ Click it and wait for the wizard to open.

Click next to skip past the welcome screen and you will be greeted with a box asking you to select an alias. This is simply a name for the directory which will be used. In this example we are using ‘work’ so write work into the box and click next. This means that it will be accessed from http://locahost/work. Next we are asked for a directory. If this is going to be a redirect then just add any directory and change it later. However if say you wanted to map this to My Documents then click browse and find My Documents. Click it and then click OK. The path will then be entered into the box for you.

Now click next again and you will be brought to the permissions screen. This is where you set the permissions and what can happen. Normally you can just click next again to pass it but this time check the box which says browse. Now click next again and finally click the finish button on the next screen to close the wizard. The directory has been created and can be seen on the list as a branch of ‘root.’

Now its time to test the new directory – open up your browser and point it to http://localhost/work so that the page loads up. This should, if you have done it correctly, bring up a list of all the files in you’re my Documents folder. Congratulations if it worked you have a virtual directory. If not then make sure you can find the directory under root and make sure the path to My Documents is correct.

Next go back to the Management Console and click root on the left. This should bring up a list of all the files and virtual directories on the right in the big box. In this box you should now find ‘work’ next to a little grey box icon. Right click on it and click properties. This will bring up a properties box named after the virtual directory.

The default selected tab on here is Virtual Directory. This basically does the same job as the Home Directory tab when we had the properties page for root on screen. The other tabs also match up to the tabs on the root properties although there are not as many as you do not have the settings for the entire site on top of the directory settings like you do when you are editing the properties of the root site.

Redirects

Finally I want to cover one more thing – setting up a virtual directory to do a redirect. To do this select Virtual Directory from the list of tabs in the properties for ‘work’ and find ‘a redirect to a URL’ from the list of bullet options at the top. Click this and all the directory information disappears to make way for redirect information.

The top box is where you enter a URL for it to redirect to. This can be a virtual directory on your computer although you cannot redirect it straight to a file. So if you wanted to link it to something in your unzipped folder on your hard drive you would have to set up a virtual directory which is set to your unzipped folder.

Here is my example. I have my directory http://localhost/work/ and the redirection URL I have entered is http://www.mworld.us/entertainment/fake.asp. If I enter this URL and don’t tick any boxes, when I enter in the address to my directory it will be replaced in the address bar by the direct URL which will go to the exact address I entered – and in this case bring up a 404 error page seen as the address is not real. The same happens if I have the box ticked saying ‘the exact URL entered above.’

However if I tick the box ‘a directory below this one’ the directory will remain in the will remain in the address bar as if it is the original directory. So I could reduce the address of http://localhost/files/folders/stuff/complext/somefile.php? variable1=somevalue&variable2=othervalue to http://localhost/somefile and it would display the same file but users would see http://localhost/somefile in their browsers.

The final tick box is ‘a permanent redirect for this resource,’ Normally redirects such as the above are temporary as the file is still in the other location and you are just masking it However if the file has moved and you want to set up a redirect to another location so your users can find it, that is when you tick the box to say – never come back to this redirect address, always use the address its redirecting to.

Final Tasks

Right, that’s done. If you don’t want that directory hanging around any more then close the properties window if it is still active and find the directory in the list in the Management Console. Then right click its name and click delete to remove it.

There is one more important thing which you will probably use when using Internet Information services. That is stopping and starting your website. If you click root again in the tree view on the left you will notice three black buttons at the top become click able. These allow you to stop, start and pause your web server. The web server only works when it is running. So if you don’t want it running then click stop. Click start again when you want to reactivate it. This is useful when your server stops delivery pages because it’s moaning of ‘heavy traffic.’ If this is the case click stop, pause for a second or two then click start again.

Conclusion

Hopefully this should get you started with the basics of internet information services. There is lots of fun to be had experimenting and playing about with the different settings so my advice is just have fun and see what you can do.

Getting started with IIS part 1

Sunday, September 16th, 2007 | Life, Tech

Internet Information Services is by far the most popular server for Windows; and not without good reason. Personally I do not know what the people who recon Apache is more configurable are on about. They should really take a look at the properties page of a website on IIS. But complaining about them is another story; we are fear to get to grips with IIS.

For those of you with Windows Server 2003 you will have IIS 6.0. However seen as anyone with Windows Server 2003 will know that they are doing anyway and most users will have Windows XP or 2000, I am going to use IIS 5.1 as my model. This should cover most versions fine anyway as the interface changes have not been radical to the best of my knowledge.

Introduction

The key to management of IIS is the Management Console. This will have a toolbar along the top, a tree view on the left and a files list on the right at the bottom which is the main section. As standard when you open it in the tree view you get Internet Information Servers with the name of your computer in a branch. In a branch of your local computer you will then have Web Sites, below that FTP sites if you have added that on although it’s not installed as default and finally Default SMTP Virtual Server.

If you don’t see this then click the box with the plus in on the left of them to expand them so that you can. The next thing to do is to do the same so you can see a list of your websites. There should only be one unless you’re running a Windows 2000 Server. The one that does exist is called root. This is your default website so let’s start configuring it to your settings. Right click on it and click properties.

Customising

This will bring up the properties box with root properties at the top and no less than eight different tabs full of settings for you to configure the website. The first section of the already selected ‘website’ tab is how the site is identified. Leave the description as root. As next one, IP addresses allows you to specify different IP addresses for different sites although one you will only have one IP address most likely and two all IP addresses go to the root folder by default anyway. So seen as we do not have multiple websites this is not a problem.

The connections box is something that can be left alone. Although if you are having problems with time outs and pages not loading you may want to play about with the seconds before timeout. Below that is the box which enables server logging. I always find these useful and use the standard W3C format to log activity in a file.

Next up click the ‘ISAPI Filters’ tab. You will probably end up with a blank list with a few buttons. This is where you can install, enable and disable ISAPI filters. An ISAPI filter is a program that responds to events during the processing of an HTTP request. In other words special executable scripts that do things when a page is requested. An example of this is PHP although there are other ways to use PHP. But as an example, when a page is requested the ISAPI filter responds and sorts out the PHP code delivering HTML to the user.

Next click the ‘home directory’ tab. This gives information on where the files are on your computer. The top box gives you three options about where the files are. Even the directory should lead to a folder on this computer, the directory should lead to a folder on a network computer or it should redirect to a different address. The first two allow you to choose a file path, the first starting with drive:\ and the second starting with a network path.

These first two options also have tick boxes about what can be run and what cannot. Read just allows users to access and view files so keep this one ticked. Log visits and index this resource should remain at their default. Directory browsing means that users get a list of the files in the directory which they can click on to visit. Sometimes this is useful but if you don’t want visitors getting a full list of all the files then don’t tick it. Finally write allows files such as text files, databases, or anything else you want scripts to be able to add data to, to be changed.

Generally the application settings below this can be ignored too. The only one you may want to change is the application permissions allowing you to disable all scripts or allow scripts and executables. Or have a happy mix between. I always leave this at default although if you want to run some executables then you may want to disable them or if users can upload scripts to this directory you may want to disable this.

Next up is the ‘documents’ tab. This one controls the list of documents that are delivered as the default document of a folder if no file name is specified. You can add as many different possible file names as you want to this box by clicking add and typing the file name including the extension in such as home.html. You then order them as you want as the higher they are the higher priority they have. A have several in mine:

Index.asp
Index.php
Index.htm
Default.asp
Default.php
Default.htm
Index.html
Default.html
Iisstart.asp

This enables me to use all the standard file names for different sites and the homepage will still be delivered as the default document. Iisstart.asp is a default one added in by IIS as if no other documents are present you will be taken to an introduction page when you first point your browser to IIS before you have set it up. You can remove that one if you wish.

The other option under this tab is document footer. This enables you to have a footer document served up at the bottom of every page. This may be useful say for a free web hosting company who wishes to add an advert or link to their homepage to the bottom of every page. Or even if you wanted to include a navigation link but didn’t want to have to update every page when you added or changed a link.

We are getting deeper now and beyond the standard options you are likely to use. But I will give a quick overview of what else can be done too in the properties window. The next tab is ‘directory security.’ This enables you to have secure communications, restrict websites and IP addresses and others.

The ‘HTTP Headers’ allows you to set how often pages expire. If your content is only updated say every 5 minutes or for instance if you only want new messages posted in a guest book to be updated every 5 minutes then you can set it so pages in this directory are only refreshed every 5 minutes. A new page will be generated every 5 minutes and this version will be delivered from the cache until the next update.

‘Custom errors’ allow you to direct users to different pages depending on what error happens. For example if you wanted to send them to a personalised error page when a page cannot be found with a dancing Jesus saying “this page does not exist’ then you would click 404 and then click edit properties. You could then choose the custom file.

Finally ‘Server Extensions’ allows you to enable use of authoring such as Front Page change version control and performance and specify settings for things such as emails and security settings. Luckily if you get stuck there is a help button at the bottom of the properties window ;).