Apache Advanced Tutorial

Source: Internet
Author: User
Tags php software browser cache

This blog post is the second of the Linux Web Architecture series of Apache, I will take you to learn the Apache compiler parameters, directory structure and configuration files and other aspects of knowledge, to achieve a further command of the Apache service, and make it better to apply to the production of combat.

First, compile the parameter

In the previous Apache deployment, we used a lot of compilation parameters, in fact, the Apache compiler parameters are not only these, these are only common in our production environment. We are in the Apache directory of the source code, the command can be used to output them all

[Root@c64-web httpd-2.4.6]#./configure--help

The output of this command is not posted here, a lot of it, I guess you do not look, some parameters 100 years also use less than once. If you want to know these parameters, you can Baidu.

Here I will explain in detail the function of our common compilation parameters

--prefix=/usr/local/apache-2.4.6 \ #表示指定apache安装路径为/application/apache2.2.25. If you do not specify an installation path, the default path is/usr/local/apache2
--WITH-APR=/USR/LOCAL/APR \ #指定apr安装路径, or you'll get an error.
--with-apr-util=/usr/local/apr-util \ #指定apr-util installation path, or it will be an error
--with-pcre \ #支持perl的正则表达式, or you'll get an error.
--ENABLE-SO \ #激活apache服务的DSO (full name dynamic shared object, dynamically sharing objects) support, that is, in the future can be the way of DSO to compile and install the shared module, the module itself can not be DSO Way to compile.
--ENABLE-SSL \ #基于ssl加密传输
--ENABLE-CGI \ #开启CGI脚本
--enable-rewrite \ # Provides overriding functionality based on URL rules. That is, the other desired URL address is converted according to the known URL address. As explained in the previous pseudo-static function is this module implementation. This is an important feature that is required in the Apache production environment.
--with-zlib \ #支持压缩
--enable-deflate \ # provides compressed transmission encoding support for content, general Html,js,css and other content sites, the use of this parameter features will greatly improve the transmission speed, enhance the visitor access experience. In a production environment, this is one of the important options for Apache tuning.
--enable-expires \ # Activation allows you to control HTTP's "Expires:" and "Cache-control:" header content through the configuration file, which provides settings for the client browser cache for content such as site images, JS, CSS, and so on. This is one of the important options for Apache tuning.
--enable-headers \ #提供允许对HTTP请求头的控制
--enable-modules=most \ #支持大多数模块
--enable-mpms-shared=all \ #mpm模块的动态切换
--with-mpm=worker #选择apache MPM mode is the worker mode. Because the worker mode principle is that more threads are used to process requests, more concurrent requests can be processed, and the overhead of system resources is less than MPM prefork based on processes. If you do not specify this parameter, the default mode is Prefork process mode. The relationship between the two, in the tuning chapter I will explain in detail.

Introduction of Apache directory structure

Familiarity with Apache's directory structure is especially important to our understanding and mastery of Apache knowledge points, and I'll take you to the Apache directory structure.

[Root@c64-web/]# tree-l 3/usr/local/apache/#以下我对输出做了精简, retaining only the commonly used
./
├──bin #存放apache命令的目录, such as Apache startup command Apachectl
├──ab #apache HTTP Server Performance testing tool, simple and easy to use. Similar software and JMeter, LoadRunner, webbench, etc.
├──apachectl #apache的启动程序, need to focus on mastering, Apachectl is a script
├──APXS #apxs是一个为apache http server to compile and install the Extension module tools, in the DSO mode module compiled will be used. This command is used later in compiling PHP software, such as:--with-apxs2=/application/apache/bin/apxs
├──htcacheclean #这是清理磁盘缓冲区的命令, you need to specify the relevant parameters at compile time to use, generally use very little.
├──HTPASSWD #建立和更新基本认证文件, such as: Configure Nagios and other monitoring services will be used.
├──HTTPD #httpd为apache的控制命令程序, Apachectl is invoked when executing httpd
└──rotatelogs #apache自带的日志轮询工具, but also can be used, but in the teacher's work scene in the habit of cronolog replaced by
├──build
├──cgi-bin
├──conf #这是apache的所有的配置文件的目录, extremely important
├──extra #这是额外的apache配置文件目录, the files in this directory we will frequently access the modified
├──httpd-dav.conf #dav支持配置
├──httpd-default.conf #这个文件里配置的是apache的相关服务参数: Timeout time, stay connected time, etc.
├──httpd-languages.conf #语言支持配置
├──httpd-mpm.conf #服务器池管理, that is, to optimize the Apache configuration file, such as: Select the Apache mode and configure the number of connections, and so on, commonly used patterns have worker mode and profork mode, the default is Profork mode.
├──HTTPD-SSL.CONF #这是apache SSL Support configuration file
└──httpd-vhosts.conf #这是虚拟主机的配置文件
└──httpd.conf #apache的主配置文件, this file will be accessed frequently, and the parameters of each row should be clearly understood.
├──htdocs #这是编译安装时apache的默认站点目录, as explained earlier.
└──index.html #默认的首页文件, in the actual environment, we are accustomed to index.html, index.php, index.jsp to do the first page file, the first file name is in the httpd.conf defined well in advance. Specific parameters: DirectoryIndex index.html
├──logs #存放apache默认的日志路径, including error log and visit log questions
├──access_log #这是apache的默认访问日志文件.
├──error_log #这是apache的错误日志文件, be sure to check out this error log if you have problems with Apache startup failures.
└──httpd.pid #httpd的pid文件, the ID number of all processes is written to this file after the httpd process is started.
└──modules #apache的模块目录, such as Php.memcache and other modules are compiled here.

The above is the directory structure of Apache description, you know what to do with it.

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.