Apache server program
Command httpd:
-T test configuration file
-L static module
-D dump_modules dynamic module
-H for help
-M: equivalent to-D dump_modules
-D dump_vhosts: List Virtual Hosts
Htpasswd:
Create and update user authentication files for file Basic Authentication
Apachectl script
Enable the HTTPd service using apachectl start
Httpd service control tool;
AB: Apache benchmark Apache Performance Benchmark Testing Tool
Apxs: httpd extends the use of third-party module tools (Hook interfaces) to hook third-party modules
Htcacheclean:
Disk cache cleanup Tool
Htdigest:
Create and update user authentication files for digest Authentication
Httxtt2dbm:
Create a file in dBm format for rewrite map (override ing table)
Rotatelogs:
If you do not close httpd and switch it to the log tool (if the site traffic is large, the monthly traffic may reach hundreds of millions), when the log file grows too fast, access_log, our rotatelogs can rename the original access_log to access_log.1, and then generate a new access_log so that our web service can write logs. Smooth log Cutting
Suexec: the user identity of the running process, which is in the configuration file.
When the HTTPd process needs to access the resource file as another user, suexec can be used for temporary identity switching.
Initial use of the AB tool: (similar tools: http_load, webdeskseige)
AB cannot simulate real scenarios
There are three types of real work environments:
1. Production Line environment: provide real services
2. Test Environment
3. Development Environment
AB [Options] URL
-C # simulate how many concurrent requests are initiated
-N # Total number of simulated requests
The value of-N must be greater than or equal to the value of-C.
For example:
[[Email protected] ~] # AB-C 50-N 500 http://www.aaabig.com/index.html
This is apachetings, Version 2.3 <$ revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to the Apache Software Foundation, http://www.apache.org/
Benchmarking www.aaabig.com (Be patient)
Completed100 requests
Assume that the transmission rate is 125 Mb/s, 1000/8 = 125 Mb/s.
Compile and install httpd2.4 in centos6
What are the new features of httpd2.4?
1) MPM supports loading at runtime: The loading method is -- enable-MPMs-shared = all, which means to compile all modules into a shared module.
-- With-MPM = {prefork | worker | event}
2) support for the event module mpm
3) support for asynchronous read/write
4) Different log levels can be used for each module and directory.
5) configuration of each request is supported: <if> <elseif>
6) support for enhanced expression Analyzer
7) Support for keep alive timeout in milliseconds
8) a VM that supports FQDN does not require the namevirtualhost command.
9) User-Defined variables can be used!
10) added some modules: mod_proxy_fcgi and mode_ratelimit.
Mod_request (more effective for user requests) mod_remoteip (more powerful control capability for remote IP addresses)
11) modified some configuration mechanisms: Order, allow, deny and IP-based access control are no longer supported, and changed to require.
By default, centos6 does not support http2.4 installation. Many features are nothing more than startup. If you need to install them, you need to manually install several versions.
The httpd program depends on APR and APR-until (httpd2.4 depends on apr1.4 and later versions)
APR: Apache Portable Runtime (equivalent to httpd running on a virtual machine), regardless of the operating system platform, it ignores the underlying differences.
1. Stop the HTTP service before installation.
2. Check whether the package group development tools server platform has been installed.
3 Use rpm-Qa | grep APR * to view the version
Httpd2.4 needs to be downloaded and put in the/tmp directory, called
650) This. width = 650; "style =" border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px "Title =" image "border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201408/13/6249823_140792458336Sw.png "" 549 "Height =" 102 "/> tick the three
Decompress apr-1.5.0.tar.bz2 and then add CD to this directory.
650) This. width = 650; "style =" border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px "Title =" image "border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201408/13/6249823_1407924594APqe.png "" 600 "Height =" 245 "/>. /configure -- Help
650) This. width = 650; "style =" border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px "Title =" image "border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201408/13/6249823_1407924596V0Oa.png "" 602 "Height =" 117 "/> installed in the/usr/local directory by default ,. /configure -- prefix =/usr/local/apr-1.5 this option is used in order not to override centos's original apr1.5.
If the installation is normal, make & make install is OK.
I will share with you some problems during installation,
Make [1]: execvp:/root/20140813/apr-1.5.1/build/mkdir. SH: Permission denied. The permission denied must be mkdir. sh itself has no write permission, so chmod A + X gives it the write permission that all users can execute.
I have encountered an error here. It is shown that: libtool: Link: You must specify an output file libtool: Link: Try 'libtool -- help -- mode = link' for M...
By looking for a problem, I felt that I had been copied from xftp> Windows> centos 6.5. Here, configure did not have the X permission, it is estimated that there must be a problem when it is switched to Windows.
The installation is complete at this time, and the following figure is displayed:
/Usr/bin/install-C-MB 644 Apr. exp/usr/local/apr-1.5/lib/APR. Exp
/Usr/bin/install-C-M 644 Apr. PC/usr/local/apr-1.5/lib/pkgconfig/apr-1.pc
For f in libtool shlibtool; do \
If test-F $ {f}; then/usr/bin/install-C-M 755 ${f}/usr/local/apr-1.5
Done
/Usr/bin/install-C-M 755/tmp/New/apr-1.5.1/build/mkdir. sh/usr/local/apr-1.5/buil
For f in make_exports.awk make_var_export.awk; do \
/Usr/bin/install-C-M 644/tmp/New/apr-1.5.1/build/$ {f}/usr/local/APR-
Done
/Usr/bin/install-C-M 644 build/apr_rules.out/usr/local/apr-1.5/build-1/apr_rules.
/Usr/bin/install-C-M 755 apr-config.out/usr/local/apr-1.5/bin/apr-1-config
[[Email protected] apr-1.5.1] #
Then, install another package named Apr-util in the same way,
[[Email protected] New] # ll
Total 6400
Drwxr-XR-x 28 1000 1000 4096 Aug 13 apr-1.5.1
-RW-r -- 1 Root 817569 Aug 12 apr-1.5.1.tar.bz2
-RW-r -- 1 Root 695303 Aug 12 apr-util-1.5.3.tar.bz2
-RW-r -- 1 Root 5031834 Aug 12 httpd-2.4.10.tar.bz2
[[Email protected] New] # tar xf apr-util-1.5.3.tar.bz2
[[Email protected] New] # cd apr-util-1.5.3
[[Email protected] apr-util-1.5.3] #./configure-help note that there is a key here-with-Apr
-- With-Apr = path prefix for installed APR or the full path
Apr-config
You need to tell Apr-util where to find Apr, so we need to specify the path of the installed Apr.
[[Email protected] apr-util-1.5.3] #./configure -- prefix =/usr/local/APR-util -- With-Apr =/usr/local/apr-1.5/
Then
Configure: Creating./config. Status
Config. Status: Creating makefile
Config. Status: Creating export_vars.sh
Config. Status: Creating build/PKG/pkginfo
Config. Status: Creating apr-util.pc
Config. Status: Creating apu-1-config
Config. Status: Creating include/private/apu_select_dbm.h
Config. Status: Creating include/apr_ldap.h
Config. Status: Creating include/Apu. h
Config. Status: Creating include/apu_want.h
Config. Status: Creating Test/makefile
Config. Status: Creating include/private/apu_config.h
Config. Status: executing default commands
[[Email protected] apr-util-1.5.3] #
Installation Complete
650) This. width = 650; "style =" border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px "Title =" image "border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201408/13/6249823_1407924597g8yx.png "" 626 "Height =" 126 "/> extract httpd first, CD to this directory, and then. /configure -- help to view help
Here we will list the long options before installation, which of the following must be added:
[[Email protected] httpd-2.4.10] #. /configure -- prefix =/usr/local/apache24 (under which directory is installed) -- sysconfdir =/etc/httpd (where is the configuration file folder)
-- Enable-so (the key is that dynamic installation and uninstallation modules are not supported)
-- Enable-SSL: Start the SSL module! (But before loading this, you need to check whether the OpenSSL-devel module has been installed)
-- Enable-CGI (CGI unsupported)
-- Enable-Rewrite (support does not support URL rewriting, which is useful)
-- With-zlib (a data packet compression library) (here we need Yum install a package named PCRE-devel)
-- With-Apr =/usr/local/apr-1.5
-- With-Apr-util =/usr/local/APR-util
-- Enable-MPMs-shared = all
-- With-MPM = event (select Event Mode)
-- Enable-modules = {All | most} (select those modules for compilation)
After compilation, make & make install. After a long installation, the installation is successful, and you can start it. First, you need SS-tnlp to ensure port 80 is not occupied, because we still have a service startup script, we need to edit/etc/profile. d/httpd24.sh
Export Path =/usr/local/Apache/bin: $ path
Run the "Source" command to check the file.
[[Email protected] httpd-2.4.10] # source/etc/profile. d/httpd24.sh
[[Email protected] httpd-2.4.10] # echo $ path
/Usr/local/Apache/bin:/usr/lib64/qt-3.3/bin:/usr/local/MySQL/bin:/usr/local/sbin: /usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
Check the path!
Apachectl start
650) This. width = 650; "style =" border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px "Title =" image "border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201408/13/6249823_1407924599fRlT.png "" 244 "Height =" 51 "/>
Yes!
650) This. width = 650; "style =" border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px "Title =" image "border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201408/13/6249823_1407924600MVD1.png "" 244 "Height =" 93 "/> it works!
After installation, you have to finish the work. Check the cgi-bin server script binary program, which is displayed by default! The page is under the/usr/local/apache24/htdocs directory after compilation and installation, but not under/var/www/html, while the server script is under the cgi-bin directory, error is not an error log, but a large number of error pages. The header files under include can also be developed based on secondary development.
If you need to put the httpd24 header file in the system for secondary development, you can use ln-SV/usr/local/apache24/include // usr/include/
Finally, you can export man help, VIM/etc/man. config, and then add:
Manpath/usr/local/apache24/man
IP-based Access Control in httpd2.4
Allow access from all hosts: require all granted
Deny Access to All Hosts: require all deny
Control access to a specific Host:
Require IP ipaddr
Require not IP ipaddr
Ipaddr:
Single IP Address
Network/netmask
Network/length: 172.16.0.0/16
Net: 172.16
Require host hostna hostname
Require not host hostname
Example: If I do not want 192.168.1.121 to access my host, define require in/etc/httpd. conf and <>. For example:
<Requireall>
Require not IP 192.168.1.121
Require all granted
</Requireall>
The connection with 192.168.1.121 is displayed as follows:
[[Email protected] TMP] # elinks 192.168.1.126
650) This. width = 650; "style =" border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px "Title =" image "border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201408/13/6249823_14079342029ByV.png "" 631 "Height =" 114 "/> no permission!
The following describes how to set up a VM in httpd2.4:
First, find the DocumentRoot entry in the main configuration file and comment it out,
215 #
216 # DocumentRoot "/web/htdoc"
217 <directory "/web/htdoc">
Locate/vhost in the master configuration file, and remove the preceding comment.
Similar
# Virtual Hosts
Include/etc/httpd/extra/httpd-vhosts.conf
Then find the/etc/httpd/extra/httpd-vhosts.conf file and modify it from it
650) This. width = 650; "style =" border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px "Title =" image "border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201408/13/6249823_1407934206fhde.png "" 611 "Height =" 451 "/> remember to use permissions <directory> </directory>.
650) This. width = 650; "style =" border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px "Title =" image "border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201408/13/6249823_1407934208EYgN.png "" 602 "Height =" 196 "/> HOST 1
650) This. width = 650; "style =" border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px "Title =" image "border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201408/13/6249823_1407934210nqQs.png "" 603 "Height =" 178 "/> host 2