Package Download:
wget http://mirror.bit.edu.cn/apache/httpd/httpd-2.4.25.tar.gz
wget http://mirror.bit.edu.cn/apache/apr/apr-1.5.2.tar.gz
wget http://mirror.bit.edu.cn/apache/apr/apr-util-1.5.4.tar.gz
Yum install-y gcc autoconf automake make pcre pcre-devel OpenSSL openssl-devel
Tar xvf apr-1.5.2.tar.gz
CD apr-1.5.2
./configure
Make
Cd..
Tar xvf apr-util-1.5.4.tar.gz
CD apr-util-1.5.4
./configure--WITH-APR=/USR/LOCAL/APR
Make
Cd..
Tar xvf httpd-2.4.25.tar.gz
CD httpd-2.4.25
./configure--prefix=/usr/local/apache2--enable-so--enable-ssl--enable-rewrite--with-mpm=worker-- With-suexec-bin--with-apr=/usr/local/apr/
Make
Cd..
--prefix//Specify installation directory
--ENABLE-SO//Turn on the modular function
--ENABLE-SSL//Support SSL Encryption
--enable-rewrite//Support address rewriting
--WITH-MPM//Set HTTP working mode
--with-suexec-bin//Support Suid,sgid
--WITH-APR//Specify APR program absolute path
Parameters
/usr/local/apache2/bin/apachectl
-t/configtest detection of HTTP configuration file syntax is correct
Graceful start httpd, do not interrupt existing HTTP connection requests
Graceful-stop close httpd without interrupting existing HTTP connection requests
Configuration file Resolution
ServerRoot "/usr/local/apache2"//HTTPD installation directory
LoadModule foo_module modules/mod_foo.so//compile-time plus--enable-so, format LoadModule module module file name
ServerAdmin [email protected]//When the site problems, the issue of the problem-solving mailbox
ServerName www.example.com//website domain name
DocumentRoot the root directory of the "/usr/local/apache2/htdocs"//web server
Errorlog "Logs/error_log"//Locating Server error log
Include conf/extra/httpd-mpm.conf//Loading additional configuration files in the Apache master configuration file
Options None//Do not enable any additional features
All: Turn on all options except MultiViews
EXECCGI: Allows all CGI scripts under the specified directory
FollowSymLinks: Allows files under the specified directory to be linked to files or directories outside of the directory
Indexes: If the URL corresponding to the options directory cannot find the DirectoryIndex specified home page document, then Apache will index all the files of the current directory
Order Command:
Detect first allow, deny on detection, default allow
Order Deny,allow
Deny from all
eg
Order Allow,deny
Allow from 192.168.1.10
Ifdefine container
The test condition is true at httpd startup and will only be processed by httpd-d definition
<IfDefine> directives </IfDefine>
eg
<ifdefine memcache>
LoadModule Mem_cache_module modules/mod_mem_cache.so
</IfDefine>
<ifdefine usecache>
LoadModule Cache_module modules/mod_cache.so
</IfDefine>
Ifmodule container
Instructions that will be processed only when the condition is met
<ifmodule[!] Modules > directives </IfModule>
eg
<ifmodule unixd_module>
User Daemon
Group Daemon
</IfModule>
User Daemon and group daemon will not be processed until the Unixd_module module is loaded
Directory container
For content in specific file systems, subdirectories, and directories
<directory directory-path> Instructions </Directory> paths can be matched with ~ regular expressions
<directory "/usr/local/apache2/htdocs" >
Options Indexs FollowSymLinks
</Directory>
<directory ~ "^/www/[0-9]{3}" >
AllowOverride None
</Directory>
Location container
<location url-path| url> Directive </Location>
Add ~ Use regular expressions
This article is from the Linux Learning Notes blog, so be sure to keep this source http://rockycai.blog.51cto.com/8871643/1888756
Apache Configuration Setup