Web server setup strategy under Linux

  
                  

Today we will look at how to put the web server under the Linux system.

LINUX system common are: CERN, NCSA, Apache in three ways, generally the most common method is to use Apache. This mode has obvious features, simple configuration, and maximum system compatibility. The following is the whole process of configuring a Linux-based WEB server in this way.

a. Apache server statement.


characterized by significant: can run on all computer platforms, including natural UNIX /LINUX systems; integrated proxy server and Perl programming scripts; access to the user session tracking; customizable server logs Also supports virtual hosting and HTTP authentication and more. Coupled with the power of the Linux system itself, we have no reason not to choose Apache.

II. Install Apache.


In general, all Linux version should contain install this package, if you install Linux system does not have to install this package from the installation CD or http: //www.apache The installation file is found on the .org/website (note that there are two versions on the web: one is the source code that needs to be recompiled after downloading, one is the executable file that can be used only after decompression), and then the installation can be performed.

1. If you download the executable file package, such as: apache_1.2.4.e.tar.gz (among digital download depending on your version may be, this is an example), that this relatively simple For beginners who are unfamiliar with Linux compilation, just execute: tar xvzf apache_1.2.3.4.tar.gz to complete the installation.

2. If the downloaded source code such as: apache_1.2.4.rpm, the first mounting apache_1.2.4.rpm rpm -ivh, and then perform "./configure" in the src directory; then perform " The make command compiles Apache; then copies the compiled executable to the /etc/httpd/bin directory; then copies the Apache configuration files: httpd.conf, access.conf, srm.conf, and mime.types to /In the etc/httpd/conf directory, the installation is complete.

III. Configure Apache to implement the WEB service.


In fact, now you have started Linux WEB service, you simply need to do Linux system connected to the Internet, and then stored in the home under "/home /httpd" directory can be . But in order to make this WEB server work more efficiently, we still need to make some settings for it. The specific configuration needs to be the four files just copied. The following two of its main configuration file httpd.conf and make some access.conf Description:.

1. httpd.conf
This file is the main configuration file, mainly used to set up server-initiated substantially The environment, that is, it is responsible for arranging how the web server runs. Its associated set parameters:

ServerType standalone /inetd: This option is to specify the role of WEB server running ways. The standalone parameter indicates that the WEB service process listens in the background for a client request in the form of a separate waiting process, and if so, generates a child process to serve it; it is more efficient. The main purpose is to set the specific port address that the main server process listens to by: Port [number] (default is 80).

The relatively standalone inetd mode is it more secure, this mode is the default RedHat Linux running Apache way. If your version is not RedHat, you need to add the following new line to the /etc/inetd.conf file: httpd stream tcp nowait httpd /etc/httpd/bin/httpd –f /etc/httpd/conf/httpd.conf; Then add a new line in the /etc/services file: httpd 80/tcp httpd.

ErrorLog: the error log is used to specify the file name and path. The format is: ErrorLog /var/httpd/error.log.
ServerRoot: Used to specify where to store the server's configuration and log files. The format is: ServerRoot /etc/httpd.
Server Admin: Set the E-mail address of the WEB administrator. The format is: Server Admin [email protected].

2. srm.conf
this resource is Apache configuration file, you want to tell the server role for the resources available on the WWW site and how to provide, its main parameters:

DocumentRoot: Used to specify the address of the main document. The format is: DocumentRoot /home/httpd/html.
DirectoryIndex: Same as the IIS settings of the Windows platform, used to specify the name of the home page file. As we all know, the home page generally uses "index.html" or "index.htm" as the file name. When set to these two file names, as long as the user issues a WEB request, the home page named "index.html" or "index.htm" will be loaded. The format is: DirecotryIndex index.html index.htm.

After the above simple configuration, your web server already has basic functions. The next thing to do is to restart the WEB service, just to make configurations take effect, we can use the following command to complete:

/etc/rc.d/init.d/httpd restart

last Let's take a look at the security aspects of the Apache service. The Apache server controls which hosts can access certain sites through the authentication system. Jutilaiyue it be achieved in two ways:

one is the host-based authentication addresses, but as most Internet users are using dynamic addresses, so in this way did not have much practical significance ;

another approach is based on user name /password authentication, it goes without saying, this method is more suitable for today's network conditions, and for specific username /password authentication to achieve, not this on Scope, you can refer to the relevant information for further study.

Copyright © Windows knowledge All Rights Reserved