Linux Configuration Web Server

Source: Internet
Author: User
Tags http authentication versions web services
Today we'll look at how to put a Web server on a Linux system.

Linux systems are common: CERN, NCSA, Apache three ways, the most commonly used method is to use Apache. This approach features obvious, concise configuration, with the greatest system compatibility, the following is the process of configuring a linux-based Web server in this way.

A. Apache server overview.

Its features are significant: it can run on all computer platforms, naturally including unix/linux systems, integrated proxy servers and Perl programming scripts, tracking access session procedures for users, customizing server logs, and supporting virtual hosts and HTTP authentication. Coupled with the Linux system itself is strong, we have no reason not to choose Apache.

Two. Install Apache.

In general, all Linux versions should contain the installation of this package, if you do not install this package in the Linux installation system, you can install the CD or http://www.apache.org/ Web site to find its installation files (note that there are two versions of the network: one is to be downloaded after the need to recompile the source code, one is only to extract the executable file can be used), and then perform the installation.

1. If you download an executable package such as: apache_1.2.4.e.tar.gz (the number of which depends on the version you downloaded, for example), then this is relatively simple, more suitable for Linux to compile unfamiliar novice users, just perform: Tar xvzf apache_ 1.2.3.4.tar.gz can complete the installation.

2. If the download is source code such as: apache_1.2.4.rpm, first install with RPM–IVH apache_1.2.4.rpm, then execute "./configure" in the SRC directory, then execute "make" command to compile Apache , then copy the compiled executable to the/etc/httpd/bin directory, and then copy the Apache configuration files: httpd.conf, access.conf, srm.conf, and Mime.types to the/etc/httpd/ Conf directory to complete the installation.

Three. Configure Apache to implement Web services.

In fact, by now your Linux has started Web services, all you need to do is to connect the Linux system to the Internet, and then store the home page in the "/home/httpd" directory. But in order to make this Web server more efficient work, we need to make some settings, the specific needs of the configuration is actually just copied the 4 files. The following is a description of the main two profiles httpd.conf and access.conf:

1. httpd.conf.
This file is the primary configuration file that is used primarily to set up a basic environment for server startup, which means that it is responsible for arranging how the Web server is run. The related setting parameters are:

ServerType standalone/inetd: This option is to specify how the Web server is run. Where the standalone parameter indicates that the Web service process listens in the background for a client's request in a separate waiting process, and if so, generates a child process to serve it; The primary is to set the specific port address on which the primary server process listens: port [number] (default 80).

The inetd mode is more secure than standalone, and this is the default way Redhat Linux runs Apache. If your version is not Redhat, 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, and then add a new line to the/etc/services file: httpd 80/tcp httpd.

ErrorLog: The file name and path used to specify the error record. Format such as: Errorlog/var/httpd/error.log.
ServerRoot: Used to specify where to store the server's configuration and log files. Format such as: SERVERROOT/ETC/HTTPD.
Server admin: Sets the Web administrator's e-mail address. Format such as: Server admin XXX@XXXX.com.

2. srm.conf
This is the Apache resource profile, which is to tell the server what resources you want to provide on the WWW site and how to provide it, and its main parameters are:

DocumentRoot: Used to specify the address of the main document. Format such as: Documentroot/home/httpd/html.
DirectoryIndex: As with the Windows platform's IIS settings, specifies the name of the first page file. As we all know, the home page generally with "index.html" or "index.htm" as the file name. When set to both filenames, the home page named "index.html" or "index.htm" is about to be transferred whenever the user issues a Web request. Format such as: Direcotryindex index.html index.htm.

After a simple configuration, your Web server already has basic functionality. The next thing to do is restart the Web service so that the configuration is in effect, and we can do this with the following command:

/ETC/RC.D/INIT.D/HTTPD restart

Finally, let's look at the security aspects of the Apache service. The Apache server can control which hosts can access certain sites through the authentication system. Specifically, it is implemented in two ways:

One is based on host address authentication, but because most of the Internet users are currently using dynamic address, so this approach does not have much practical significance;

Another way is based on the user name/password authentication method, it is self-evident that this way more suitable for today's network situation, and for specific user name/password authentication implementation, not in this article discussion scope, you can refer to the relevant information for further study.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.