Posts Tagged ‘web server’

MaxClients (150) is not an integer multiple

Wednesday, January 23rd, 2013 | Life, Tech

Starting Apache on Gentoo, you may get warnings similar to the following.

chris@server ~/lime $ sudo /etc/init.d/apache2 stop
Password: 
 * Stopping apache2 ...
WARNING: MaxClients (150) is not an integer multiple
 of ThreadsPerChild (35), lowering MaxClients to 140
 for a maximum of 4 child processes,
WARNING: MaxClients (25) must be at least as large
 as ThreadsPerChild (35). Automatically
 increasing MaxClients to 35.                                                                                    [ ok ]
chris@server ~/lime $ sudo /etc/init.d/apache2 start
 * Starting apache2 ...
WARNING: MaxClients (150) is not an integer multiple
 of ThreadsPerChild (35), lowering MaxClients to 140
 for a maximum of 4 child processes,
WARNING: MaxClients (25) must be at least as large
 as ThreadsPerChild (35). Automatically
 increasing MaxClients to 35.

You can resolve these warnings by editing your mpm file and changing ThreadsPerChild so that MaxClients becomes a multiple of it. In this case, setting it to 25 should do the trick.

sudo vim /etc/apache2/modules.d/00_mpm.conf

Change the values and save the file. Now restart Apache and it should stop the warnings.

You could also change MaxClients, but this would only resolve the first warning, and not the second.

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 ;).

Configuring PWS (Microsoft Personal Web Server)

Sunday, September 16th, 2007 | Life, Tech

Personal Web Server is pretty easy to configure. Even back in 1995 when it was all web based. However in this article I am looking at the PWS version which was shipped with Windows 98 and ME software.

The basic’s to it are very simply. In fact the only page of options we will be looking at is the advanced page. Open up your personal web server consol from the system tray and click advanced down the left hand side.

You should now be presented with a tree like view with the top root document and several sub folders. From here you can add virtual directories. Virtual directories are directories which aren’t really there but are instead linked to it.

For instance if you had two directories, your main website root C:\websites and a downloads directory which you wanted to be on your server at C:\downloads. Obviously you don’t want the move this folder into your other folder. And so you create a virtual directory so that http://localhost/downloads goes to C:\downloads rather than C:\websites\downloads.

Beware: Virtual directories override physical (normal) directories. So if you had both a virtual directory called downloads and a folder in your website root called downloads, the virtual directory would be used instead of the folder when using hyperlinks, etc.

In PWS you can create as many virtual directories as you like. Click add below the list of directories. You can also add virtual directories within virtual directories so you could set up http://localhost/downloads/games to go to C:\games rather than C:\downloads\games. To do this click on the downloads virtual directory before clicking new, rather than click the root directory and then clicking new.

You can change the properties of each of the directories including the root directory by clicking it and then click properties. Here you will probably be presented with a name for the directory (unless it is the root) as well as the file path to the directory.

You also have 3 tick boxes. Read which allows people to read the files in the server. You will almost always want to keep this ticked. The second one is script which allows the web server to run scripts. This is another one you will want to keep ticked.

The final one is write. This allows files such as text files and databases to have data added and removed this one. It’s a good idea to keep this one ticked if its your own server so you can run scripts such as ones that change database’s and is required if you want to alter any files.

There are also a few options on the main page of the advanced section at the bottom. One of these is “allow directory browsing.” This means that if a user goes to a folder, for example http://localhost, they will be presented with a list of the files and folders in the directory which they can click on.

Default document allows a file to be served as a kind of homepage when a user goes to a directory. For example if your default document file name was home.htm, when a user went to http://localhost, they would get home.htm if it existed.

The standards for default documents are default and index in which you should list several file formats. I use .asp .htm and .html though if you use other formats such as php and cfm you should list these too.

Conclusion

Personal Web Server has quite a few customisation options for each directory as well as the entire site and despite its problems with not being able to cope with high traffic or indeed anything above very little traffic, makes a great testing server especially for active server page developers.