Basic knowledge about Linux Apache Web Server

Source: Internet
Author: User
Tags http authentication perl script

1. What is WWW service?

One of the most popular services on the Internet is the World Wide Web (WWW) service. Web has become the main means for many people to search and browse information on the Internet. WWW is an Internet service that provides an interactive graphic interface. It has powerful information connection functions.

It allows thousands of users to access the latest information and services of various universities, organizations, and companies through a simple graphic interface.

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 and disconnect immediately after reading it. When we need another webpage, We can repeat it.

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. Users are reducing the number of requests. If you are interested, refer to ftp://ftp.w3.org/pub/www/bin.

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, with a small program and fast speed. 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 get it in ftp://ftp.ncsa.uiuc.edu.

Apache

According to a survey conducted by the famous WWW Server Survey Company, more than 50% of WWW servers in the world are using 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;

. Supports virtual hosts;

. 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 the http://www.apache.org. 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, which needs to be re-compiled after downloading, and executable files, which can be decompressed after downloading.

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 the apache_1.2.4.tar.gz software package containing the apachesource code;

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.

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.

 

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.