First, the experimental installation environment
System:centos6.6-i686
Software:httpd-2.2.31.tar.gz
Shut down firewall:/etc/init.d/iptables stop
Close Selinux:setenforce 0
Ii. Introduction and installation of Apache
1.apache introduction  
Apacheweb service software, providing http service.
2.apache
Simple, fast, and widely used, mainly for static small files.
Apache combine php can achieve dynamic.
3.apache download and its compiled installation
Yum-y Install zlib Zlib-devel
wget http://mirrors.sohu.com/apache/httpd-2.2.31.tar.gz
Tar XF httpd-2.2.31.tar.gz
CD httpd-2.2.31
./configure \
--prefix=/application/apache2.2.31 \
--enable-deflate \
--enable-expires \
--enable-headers \
--enable-modules=most \
--ENABLE-SO \
--with-mpm-worker \
--enable-rewrite
Make && make install
Start Apache: /apalication/apache/bin/apachectl start
Check whether it starts: lsof-i: 80
Error Resolution Method:
[Email protected] extra]#. /.. /bin/apachectl-t
Httpd:could not reliably determine the server ' s fully qualified domain name, using 127.0.0.1 for ServerName
Syntax OK
VI conf/httpd.conf find servername plus as follows:
#ServerName www.example.com:80
ServerName 127.0.0.1:80
Apache installation succeeds after completing the appeal steps.
Third, the test is successful
Enter the IP of the system environment in the browser and see It works! That means the installation was successful ...
Iv. An explanation of the Apache master configuration file
[Email protected] conf]# VI httpd.conf
ServerRoot "/application/apache2.2.31"
Listen---ports to listen on
<ifmodule!mpm_netware_module>
User Daemon
Group Daemon
</IfModule>
DocumentRoot "/application/apache2.2.31/htdocs"---Site root directory
<directory/>---Permission Control/
Options FollowSymLinks
AllowOverride None
Order Deny,allow
Deny from all---Reject All
</Directory>
<directory "/application/apache2.2.31/htdocs" >
Options Indexes FollowSymLinks--
AllowOverride None
Order Allow,deny
Allow from all---Allow all
</Directory>
<ifmodule dir_module>---specifies access to the home page profile.
DirectoryIndex index.html
</IfModule>
<filesmatch "^\.ht" >
Order Allow,deny
Deny from all
Satisfy All
</FilesMatch>
Errorlog "Logs/error_log"---error Log
LogLevel warn
<ifmodule log_config_module>
Logformat "%h%l%u%t \"%r\ "%>s%b \"%{referer}i\ "\"%{user-agent}i
\ "" Combined
Logformat "%h%l%u%t \"%r\ "%>s%b" common
<ifmodule logio_module>
Logformat "%h%l%u%t \"%r\ "%>s%b \"%{referer}i\ "\"%{user-agent
}i\ "%I%O" Combinedio
</IfModule>
Customlog "Logs/access_log" common
</IfModule>
<ifmodule alias_module>
scriptalias/cgi-bin/"/application/apache2.2.31/cgi-bin/"
</IfModule>
<ifmodule cgid_module>
</IfModule>
<directory "/application/apache2.2.31/cgi-bin" >
AllowOverride None
Options None
Order Allow,deny
Allow from all
</Directory>
DefaultType Text/plain
<ifmodule mime_module>
Typesconfig Conf/mime.types
AddType application/x-compress. Z
AddType application/x-gzip. gz. tgz
</IfModule>
<ifmodule ssl_module>
Sslrandomseed Startup Builtin
Sslrandomseed Connect Builtin
</IfModule>
Virtual Master Deployment machine:
deploy multiple sites, each with a different domain name and site directory, or different ports, differentIp, the functionality of the virtual host is required.
An HTTPMultiple virtual hosts are required to configure multiple sites for a service
Classification of Virtual hosts:
1.Domain-based(This article mainly explains this)
2.Port-based
3.based onIp
Domain nameSite Directory
Www.chen.com/var/html/www
Bbs.chen.org/var/html/bbs
Blog.chen.org/var/html/blog
1) Create a site Directory
Mkdir-p/var/html/{www,bbs,blog}
2) write index.html to the inside
For name in WWW blog bbs; Do echo "http:/$name. chen.com" >/var/html/$name/index.html; Done
[Email protected] conf]# tree/var/html/
/var/html/
├──bbs
│└──index.html
├──blog
│└──index.html
└──www
└──index.html
3 Directories, 3 files
[Email protected] conf]#
3) View content information inside
For name in WWW blog bbs; Do cat/var/html/$name/index.html; Done
4) Open the Apache Master Config file to remove the # number in front of the Include conf/extra/httpd-vhosts.conf
# Virtual Hosts
Include conf/extra/httpd-vhosts.conf
5) Open the/application/apache/conf/extra/httpd-vhosts. conf configuration file and make the following changes
#www. chen.com vhosts
<virtualhost *:80>
ServerAdmin [email protected]
DocumentRoot "/var/html/www"
ServerName www.chen.com
Serveralias chen.com
Errorlog "Logs/www-error_log"
Customlog "Logs/www-access_log" common
</VirtualHost>
#bbs. chen.com vhosts
<virtualhost *:80>
ServerAdmin [email protected]
DocumentRoot "/var/html/bbs"
ServerName bbs.chen.com
Errorlog "Logs/bbs-error_log"
Customlog "Logs/bbs-access_log" common
</VirtualHost>
#blog. chen.com vhosts
<virtualhost *:80>
ServerAdmin [email protected]
DocumentRoot "/var/html/blog/"
ServerName blog.chen.com
Errorlog "Logs/blog-error_log"
Customlog "Logs/blog-access_log" common
</VirtualHost>
Check syntax and smooth restart after configuration is complete:
/application/apache/bin/apachectl-t
/application/apache/bin/apachectl Graceful
6) parsing in the Hosts file in Windows
10.0.0.6 ww.chen.com bbs.chen.com blgo.chen.com
7) Enter the domain name to achieve access.
This article is from "Wake up your not alarm clock but dream" blog, please be sure to keep this source http://purify.blog.51cto.com/10572011/1772656
Apache compiler installation method and configuration