How to build Lamp Web service platform in Linux system

Source: Internet
Author: User
Tags locale port number root directory linux

First, install HTTPD server

1. Edit Installation

Before you configure the Apache Web server, you need to properly install the httpd server software.

1). Get Package

2). Extract and release the source pack

3). Configure compilation options

You can perform the "./configure–help" command to view the details of various configuration items before you configure them for a more flexible, richer feature customization configuration.

--prefix is used to specify the system directory where the HTTPD service program will be installed, setting the default directory "/usr/local/apache2";

--enable-so is used to enable the HTTPD service to dynamically load the module function;

--enable-rewrite is used to enable the HTTPD service to have rewrite Web page address rewriting capabilities.

4). Compiling the server program

You need to perform a "make" command to compile and convert the source code into an executable program.

5). To install a compiled completed program

The "Make install" command completes the final installation process, copying the compiled HTTPD program and related directories and files to the preset installation directory.

Second, httpd service base

1.web Server Basic Construction

1). Modify the primary configuration file httpd.conf

Open the httpd.conf main configuration file with the VI editor and add a configuration line that sets the Web server domain name. The configuration item that needs to be used is "ServerName"

[Root@www ~]# vi/usr/local/apache2/conf/httpd.conf

ServerName www.qq.com

Using ServerName to set the host domain name, you should set the corresponding a record in the authoritative DNS server for that domain so that all hosts can access the

Web server

2). Check the syntax settings for the httpd.ocnf file

Use the Apachetl command with the "-t" option to check the configuration content for syntax (or to use the "httpd–t" command). If there are no grammatical errors, you will

Displays "Syntax OK" information.

[Root@www conf]#/usr/local/apache2/bin/apachectl–t

Syntax OK

3. Start, terminate and restart httpd service

Use the Apachectl command with the "Start" option to launch the HTTTPD service.

[Root@www ~]#/usr/local/apache2/bin/apachectl start

[Root@www ~]# NETSTAT-ANPT | Grep:80

TCP 0 0:: £ º::* LISTEN 21669/HTTPD

If you want the HTTPD service to run automatically after the server is powered on, you can write the corresponding startup command to the "/etc/rc.d/local" file.

2.httpd.conf configuration file

This article URL address: http://www.bianceng.cn/OS/Linux/201410/45503.htm

The httpd.conf file is the primary configuration file for the HTTPD service, which contains configuration items that directly determine the various running parameters and server performance of the Web server.

1). httpd.conf configuration file

Consists of the comment line and the set line, the comment line starts with "#", and the set row does not start with "#", which is the actual set content in the configuration file.

command to get rid of the comment line.

[Root@www ~]# cd/usr/local/apache2/conf/

[Root@www conf]# CP httpd.conf Httpd.conf.bak

[Root@www conf]# grep-v ' # ' Httpd.conf.bak | Grep-v ' ^$ ' > httpd.conf

2). Global configuration in httpd.conf,

The httpd.conf configuration file includes a significant number of global configuration items that are not included in any zone and determine the global parameters of the Apache server.

The following are the contents and annotations of the global configuration items commonly used in the httpd.conf file.

ServerRoot "/usr/local/apache2"//To set the root directory of the httpd server

Listen 80//To set the port number of the listener

User daemon//used to set the identity of the person running the HTTTPD process

Group daemon//used to set the team identity when running the HTTTPD process

ServerAdmin web@qq.com//To set up an administrator's e-mail address

ServerName www.qq.com//for setting FQDN

DocumentRoot "/usr/local/apache2/htdocs"//For setting the Web page document root directory

DirectoryIndex index.html index.php//For setting the default home page for the site

ErrorLog "Logs/error_log"//To set the path and filename of the error log file

LogLevel warn//level for setting records, default to warn (warning)

Customlog Logs/access_log common//the path and format type used to set access log files

Pidfile Logs/httpd.pid//For setting save HTTPD Server program feed and number (PID) files

Timeout 300//timeout for setting the network connection between the server and the browser

KeepAlive on//for setting whether to use the stay connected feature

Maxkeepaliverequests 100//To set the maximum number of files that the client can request to respond to each connection

KeepAliveTimeout 15//For setting timeout seconds to keep the connection

Include conf/extra/httpd-vhosts.conf//for content that contains another configuration file

... ...

3). Regional Settings in httpd.conf

In addition to global settings items, the htttpd.conf file is included in most configurations in the zone, and the locale uses a pair of combination tags that qualify the configuration item's

Scope, for example, the common directory area in a configuration file is as follows:

<directory/>

Options FollowSymLinks

AllowOverride None

Order Deny,allow

Deny from all

</Directory>

In the above area definition, use the <directory/> to define the start of the zone, use </Directory> to define the end of the zone, in which the setting content only functions

Within the zone and not in the global or other zones. The directory locale is primarily used to set access control permissions for a specific directory. In addition to the directory area, it is often

Set up an area such as a virtual host such as "<virtualhost> ... ...</virtualhost>".

4). httpd Service Log

HTTPD server includes access log and error log two common log files, you can see the log file to understand the Apache server operation, you can also row

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.