|
Search |
The purpose of this guide is to install the APACHE server. The APACHE web server has been choosen because it is the most used at the moment. In addition, it is free and its source code is available on the site: http://www.apache.org. Warning!! the OVH system already has the configuration. You can find too the standard scripts of compilation on our server:
The version on which we are going to work in this guide is the 1.3.4. You can find it on the site http://www.apache.org You must download the file apache1.3.4.tar.gz Before unzipping the downloaded file, you must create a temporary directory with the command: mkdir directory-name Next, you must decompress the file with the following commmand: tar zxvf file-name.tar.gz The file is zipped and tar. You must decompress the sources into the temporary directory, which was previously created. The files allowing the Apache set up are as follows: install and all the files contained in the htdocs/manual directory Thanks to these files, we have been able to know that the minimun space to install Apache is 12 MB and that the installation needs a C ANSI compiler. To compile the Apache server, you must type the following commands: ./configure --prefix=PREFIX where PREFIX corresponds to the installation path (For example: /usr/local/apache) make make install PREFIX/sbin/apachectl start, which allows to start the HTTPD daemon and then to check if the compilation has been successful. PREFIX corresponds to the setup directory too. Even if 2 software exist to configure the APACHE server, here we will give the configuration methods of APACHE by modification of text files contained in the conf directory. The configuration files are in the /etc/httpd/conf directory There are 3 important files in the configuration:
The following command allows to start the server: apachectl start The following command allows to restart the server: apachectl retstart The following command allows to stop the server: apachectl stop In the following parts, it is necessary to have previously created a user. If it is not the case, you must create it with the command: adduser e.g a toto user adduser -g users toto To change the user name, who will launch the web server (here toto), you must edit the http.conf file. Find the line where User is written and replace nobody by toto. #User is the username with which the server accesses to resources of the computer. User toto To change the virtual port on which the web server goes lock on, you must edit too the http.conf file. Find the line where Port is written and replace the value which is after the port number that you want. Warning: some ports are reserved (FTP, Telnet, ...) The configuration thus is as follows: #The server port by default is 80 and we have replaced it by 3000 Port 3000 Warning!! If you change the virtual port, when you connect on the toto web site, you must specify the new port In this part, we want to change the configuration when we search the url http://my-server/toto, APACHE search the tutu.html file in the WWW directory of the toto user. To do so, we must edit the srm.conf file. Find the line where "DirectoryIndex" is written and replace the following by the file to load. Name of file(s) to display by default, when no file is given in the URL If you want to specify many files, you must put them one after the other DirectoryIndex path/toto/WWW/tutu.html It is possible to change the error messages by editing the srm.conf file and modify the content following the keyword ErrorDocument? For Example: ErrorDocument 500 "the server made a mistake" by: OR ErrorDocument 404 /missing.html will have for consequence to display the missing.html page when the server does not find a page (404 error code) There are two ways to test a server: The first one is very classic, try to display a page with a web browser. The second one is to test a connection on the web server by the telnet tool. By telnet, we can directly write the request to receive the response in text mode. Here is an example of use with the telnet command: we can recover the presentation page of a web site by typing telnet vodka 8080 then get /index.html HTTP/1.0 followed by double ENTER. The server response is in two parts: First, the header which indicates if the question has been understood by sending a return value (here 200 OK), if the resource has been found, the resource type, etc ... HTTP/1.0 200 OK Server : JavaWebServer/1.0.2 Content-type : text/html Last-modified : Fri, 30 Jan 1998 13:55:28 GMT Connection :Close Date : Wed, 06 Jan 1999 16:12:28 GMT then the own resource: the HTML page, the GIF picture, etc ... Some different return codes: 404 Not Found : The page does not exist 400 Bad Request : The request can not be understood The In order the server to use the least of process at the start, you must edit the httpd.conf file and research the string "startservers". We find after this string the number 5, replace this number by 1 to launch only one process. Definition of If this variable is put on Then we find after this variable other ones linked to Definition of The Definition of If this variable is put on We must find a serie of icons names (keyword The purpose is to restrict the access rights of a web site directory. this is done in two steps:
require valid-user /directory/page.html is the protected page
The creation of a password is possible with htpasswd programm, which takes the following syntax: htpasswd [-c] passwordfile username with the -c option, the file is created; without the -c option, the file is completed by the new entry. passwordfile is the file name containing the passwords. username is the user name |