If, when you attempt to open the file for the first time, you receive an error message advising that you do not have an associated program with which to open this type of file (as I did), you will need to choose Notepad from the list of selected programs. If this fails to work; browse to the location of the file - as stated above – then open a blank Notepad window and just drag the file in. The file itself is broken up into three distinct sections: the global environment, the ‘main’ server configuration, and the virtual hosts section. The first section enables you to change settings that affect the overall operation of the server, and for our purposes here, can pretty much be left unchanged (although do read through some of the comments to give yourself a better overview of how the program works.) The second section is where we will make most, if not all, of our modifications. This is the section which deals with which folders the server looks in when pages or files are requested by the browser, and the settings and preferences regarding what is allowed to be executed from these folders. So, with the httpd file open, scroll right down through the first section, and right near the top of the second section (line 210), you’ll see ServerName. If this doesn’t say localhost:80, change it so that it does. Next, change the DocumentRoot statement (which is the second actual statement following ServerName) to read as follows:
Now scroll down to the second instance of the <Directory > option. This, as stated in the block of comments above it, should be changed to whatever you set DocumentRoot to; in this case:
Directly below the comments that follow the above statement, you’ll see a statement that begins with Options. Make sure that this line contains the words Includes and ExecCGI, so that it looks like this:
This will enable SSI and executable CGI scripts in your DocumentRoot. If there is a # symbol at the start of this line, ensure that you remove it. Scroll down a bit more and you’ll see the UserDir statement, make sure it says: UserDir "My Documents/My Website" Almost directly below this, there is another <Directory > option. You will need to remove all of the # symbols from the opening <Directory > to the closing </Directory > Tag and this will need to be set to:
Again, I’ve found it best to add Includes and ExecCGI in the options statement below this. Below this closing <Directory > tag, there is the DirectoryIndex statement; simply append index.htm and index.cgi to the end of this line. You’ll need to scroll down quite a way now, until you come across the line that begins with ScriptAlias /cgi-bin/. Change this line to read:
There may be a comment symbol (#) at the start of the ScriptAlias statement, if so, remove it. Four lines below this amend the <Directory > tag to:
Now scroll down for some time until you see the AddType application lines. In order to use PHP, you’ll need to add the following directive:
Insert the above line directly below the AddType directives already present, and then add the following statements directly below that:
The ScriptAlias needs to match the directory you’ve installed PHP in, so amend it accordingly. Now a little further down you’ll find the AddHandler directive. All you need to do here is add .bat and .pl to the end of this line. Also add AddHandler server-parsed .html to the very next line. Keep going down, and very soon you will see AddType text/html .shtml, which can be left as-is, but may need to delete the # from the start of the line, and will need:
added to the next line. You’ll be relieved to hear that that is the end of configuring the conf file. Save the document and then restart the Apache Server.
blog comments powered by Disqus |
|
|
|
|
|
|
|