Linux Apache Web Server

Source: Internet
Author: User
Tags http authentication perl script

The business community quickly saw its value. Many companies have established their homepages, used Web to publish messages on the Internet, and used them as interfaces for various services, such as detailed descriptions of customer services, specific products and services, wide promotion, and increasing product sales and services. Commercial use has promoted the rapid development of global information networks.

If you want to introduce yourself or your company to the world through the home page, you must put the home page on a Web server. Of course, you can use some free home page space for publishing. However, if you have the conditions, you can register a domain name, apply for an IP address, and ask your ISP to resolve the IP address to your Linux host. Then, set up a Web server on the Linux host. You can store the home page on your Web server and publish your home page.

WWW is a combination of Client/Server-based information discovery technology and hyper-text technology. The WWW server uses HTML hypertext markup language to organize information into hyper text. The WWW browser provides a user interface based on HTTP Hypertext Transfer protocol. You can use the WWW browser to access HTML hypertext on the remote WWW server over the Internet, as shown in:

HTTP protocol

WWW browser <-----> WWW Server

In the working environment of the WWW Client/Server, the WWW browser plays a controlling role. The task of the WWW browser is to use a URL (Internet address) to obtain a web document on the WWW server, interpret this HTML and display the document content to the maximum extent as permitted by the user environment. The process is as follows:

The WWW browser connects to the corresponding remote WWW server based on the URL entered by the user;

Obtain the specified web document;

Disconnect from the remote WWW server.

That is to say, when we browse a website, we establish a connection for each webpage,

It will be disconnected immediately after reading it. When another web page is needed, it will be resumed.

2. Comparison and Selection of WWW server software

At present, there are many companies and academic groups around the world that develop different www servers based on different computer systems, such as Apache, CERN httpd, Microsoft Internet Information System, NCSA HTTPd, plexus httpd, and website. Common Unix/Linux systems include CERN, NCSA, and Apache.

CERN httpd

This is the earliest WWW server software. It was written in C language and has limited functions.

Reducing. If you are interested, you can find it in.

NCSA httpd

At the early stage of WWW server development, the National Super Computer Application Center (NCSA)

The first-class WWW server created in 1995. It is also written in C language,ProgramSmall and fast. But now the main developer of the ncsa www server has left the NCSA and the server project has paused. I believe that you will not choose a developing WWW server software!

Of course, due to its special historical position, I believe there are still many people using it. If you need it, you can obtain it.

Apache

According to a survey by the famous WWW server research company, more than 50% of the world's

All www servers use Apache, which is the world's top Web server.

The emergence of Apache is dramatic. After the ncsa www server project pause, those who use the ncsa www server began to exchange their patches for the server, and they soon realized that it was necessary to set up a forum to manage these patches. In this way, the Apache Group was born, and then the group created Apache on the basis of NCSA.

The main features of Apache are:

. Can run on all computer platforms;

. Supports the latest HTTP 1.1 protocol;

. Simple and powerful file-based configuration;

. Supports General Gateway Interface CGI;

. Supported;

. Supports HTTP authentication;

. Integrate the Perl script Programming Language ;

. Integrated proxy server;

. Custom server logs are available;

. Supports server-side inclusion commands (SSI)

. Supports Secure Socket Layer (SSL)

Tracking the user session process;

. Supports FastCGI;

Java Servlets is supported.

What is the reason for us to abandon this powerful and promising WWW server software?

3. install Apache

Next we will start a long journey to conquer Apache. Through step-by-step demand instances, we will learn how to use Apache step by step, from getting started to being proficient.

3.1 system requirements

Running Apache does not require too many computing resources. It runs well on a Linux system with 6-10 MB hard disk space and 8 mb ram. However, running Apache alone may not be what you want to do. More likely, you want to run Apache to provide the WWW Service, start the CGI process, and make full use of all the amazing functions that WWW can provide. In this case, you need to provide additional disk space and memory space that reflect the load requirements. That is to say, if you only start the WWW Service, you do not need too many system resources, but you need more system resources to provide services to a large number of customers.

3.2 obtain software

You can get the latest Apache version in. Almost all Linux distributions contain the Apache Software Package. You can also use it directly.

Note that there are two types of Apache software packages: Source code After the download, you need to re-compile the file. The other is the executable file, which can be used only after being decompressed.

3.3 install software

You can install the Apache server in the following three ways.

1. if Apache is installed in the Linux version, select the HTTPd service when selecting the server to be installed. The Linux installation program automatically installs Apache, make basic configurations.

2. Use the executable file package, which is suitable for beginners who are not familiar with compilation, because it is relatively simple.

Download the software package apache_1.2.4.e.tar.gz

Tar xvzf apache_1.2.4.e.tar.gz

This completes the installation, simple!

If you are using RedHat Linux, You can also download the apache_1.2.4.rpm Software

Install the package and run the rpm-IVH apache_1.2.4.rpm command.

3. If you want to make full use of the Apache server, you must compile the Apache

Customize its functions.

Download an Apache sourceCodeApache_1.2.4.tar.gz;

Then use the tar command to unbind it;

Change the current directory to the src directory of the Apache source code release;

Copy the configuration sample file (configuration. tmpl) as the configuration file;

Edit the configuration options in the configuration file:

Makefile configuration options: Some compilation options:

. The "cc =" line specifies what compilation software is used for compiling. It is generally "cc = GCC ";

. If you need to specify the additional flag (parameter) to the C compilation software, you can use:

Extra_cflags =

Extra_lflags =

. If the system requires special libraries and include files, you can specify them here:

Extra_libs =

Extra_includes =

If you want to change the code optimization settings, you must remove the following comments. However

Then change it to the value you need:

# Optim =-O2

Rule Configuration option: used to determine what features are required. Generally, this option does not need to be changed.

Module configuration: the module is a component of Apache and adds new features to the Apache kernel. By using module configuration, you can customize the functions required on the Apache server, which is also a manifestation of Apache flexibility. The module configuration line is as follows:

Addmodule modules/standard/mod_env.o

If you need the functions of the Apache server, add the module to the configuration file configuration using the addmodule statement.

The following table lists the functions of Apache modules:

Module name function default

Mod_access provides Host-Based Access Control Command y

Mod_actions can run the mime-type CGI script or HTTP Request Method y

Mod_alias can execute URL redirection service y

Mod_asis enables documents to be sent to client y without an HTTP Header

Mod_auth supports user name and password stored in text files for authentication y

Mod_auth_dbm support using dBm file storage basic HTTP Authentication n

Mod_auth_mysql supports using MySQL database for basic HTTP Authentication n

Mod_auth_anon allows anonymous access to the region Y to be authenticated

Mod_auth_external supports third-party authentication n

Mod_autoindex automatically generates a dynamic directory list y when the index file is missing.

Mod_cern_meta provides support for metadata n

Mod_cgi supports CGI y

Mod_dir can redirect any request to the command without the tail slash character y

Mod_env enables you to pass environment variables to CGI or SSI script n

Mod_expires lets you determine how Apache handles expires y when the server responds to a request

Mod_headers can operate the HTTP Response Header labeled y

Mod_imap provides graph ing support N

Mod_include enables SSI n

Mod_info provides a comprehensive description of server configuration y

Mod_log_agent allows users to store proxy information in separate log files. n

Mod_log_config supports logging y

Mod_log_referer provides the function of writing the referer header in the request to logs. n

Mod_mime is used to provide meta information about documents to the client. Y

Mod_negotiation provides support for content negotiation y

Mod_setenvif enables you to create custom environment variable Y

Mod_speling enables you to process URL requests containing spelling or case-insensitive characters n

Mod_status allows administrators to manage Apache y through the Web

Mod_unique_id provides each request with a unique identifier N under special conditions.

Table 1: Functions of the Apache module

Run "./configure" in the src directory ";

Compile Apache: Execute the command "make ";

Depending on the performance of the machine, after 5-30 minutes of compilation, you are done.

Copy the compiled executable file httpd to the/etc/httpd/bin directory;

Copy the configuration files of Apache release: Access. conf, httpd. conf, mime. types, and SRM. conf to the/etc/httpd/conf directory. So far, the installation is complete.

3.4 instructions

In Red Hat Linux 6.0, Apache stores all its configuration files and log files in the "/etc/httpd" directory, "/etc/httpd/conf" is the configuration file, and "/etc/httpd/log" is the log file.

At the same time, it will create the "/home/httpd" directory and create three subdirectories under it: "html/": store HTML (home page) files under this directory; "cgi-bin/": Some CGI programs can be stored in this directory; "icons/": some icons that come with the server are stored in this directory.

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.