1, installation
Yum InstallZlib Zlib-devel-yTarXF httpd-2.2. -.Tar. GZ CD httpd-2.2. -./Configure--prefix=/application/apache2.2.27 --enable-deflate--enable-Expires--enable-Headers--enable-modules= Most--enable- So--with-mpm=worker--enable-rewrite Make&& Make InstallLN-s/application/apache2.2.27//application/Apache./Configure--prefix=/application/apache2.2.27 --enable-deflate \ #压缩--enable-expires \ #超时--enable-headers \ #http头--enable-modules= Most--enable- So--with-mpm=worker \ #apache两种模式, worker: Process thread, perform: process provides service--enable-rewrite Make&& Make InstallLN-s/application/apache2.2.27//application/apache
Check syntax and start
/application/apache/bin/apachectl-t
/application/apache/bin/apachectl start
Master configuration file
" /application/apache2.2.27/htdocs " ...
#打开vhost配置Include conf/extra/httpd-vhosts.conf ...
Include conf/extra/httpd-mpm.conf #默认perfork模式, if you open MPM is worker mode
127.0. 0.1 :
Virtual Host Configuration
[Email protected] extra]# vim httpd-vhosts.conf
#虚拟主机支持, you must open Namevirtualhost*: the<virtualhost *: the>ServerAdmin781647046@qq. com documentroot"/var/html/www"ServerName www.lanny.com serveralias www.ma.com errorlog"Logs/www-error_log"Customlog"Logs/www-access_log"Common</virtualhost><virtualhost *: the>ServerAdmin781647046@qq. com documentroot"/var/html/blog"ServerName blog.lanny.com serveralias blog.ma.com errorlog"Logs/blog-error_log"Customlog"Logs/blog-access_log"Common</virtualhost><virtualhost *: the>ServerAdmin781647046@qq. com documentroot"/var/html/bbs"ServerName bbs.lanny.com serveralias bbs.ma.com errorlog"Logs/bbs-error_log"Customlog"Logs/bbs-access_log"Common</VirtualHost>Serious NOTE: If you do not add Namevirtualhost*:80 below will be an error.
Virtual Host 403 Error:
append to httpd.conf after modification " /var/html "> allowoverride none Options none Order allow,deny allow from all </ Directory>
403 error will be reported if index.html or the file accessed is not present
mkdir /var/html/{www,blog,bbs}-ptouch /var/html/{www,blog,bbs}/index.html for in www bbs blog; Do Echo " $i. lanny.com " >/var/html/$i/index.html; Done for in www bbs blog; Do cat /var/html/$i/index.html; Done
Strace command: Trace Why the CPU is high. (Usually the program bug, there is a dead loop, etc.)
strace/application/apache/bin/Apachectl–m
Apache Compilation Installation