Environment Description
CentOS 7 x64 4cpu 2G memory in VMware 12
The installation of the CentOS 7 compilation installation MySQL-5.7.9, CentOS 7 compilation installation PHP7, and the firewall and open ports are already installed in the environment
Refer to "Configuring Firewalls and open Ports" in the CentOS 7 compilation installation MySQL-5.7.9 to compile the dependencies required to install httpd
Download
Apr-1.5.2.tar.gz
Apr-util-1.5.4.tar.gz
Httpd-2.4.17.tar.gz
Pcre-8.38.tar.gz
Upload to/root/directory
######Compile and install apr-1.5.2.tar.gz
[root@localhost ~]# tar zxf apr-1.5.2.tar.gz && cd apr-1.5.2
[root@localhost apr-1.5.2]# yum install gcc libtools -y
[root@localhost apr-1.5.2]# ./configure --prefix=/usr/local/apr
[root@localhost apr-1.5.2]# make && make install
[root@localhost apr-1.5.2]# cd .. && rm -rf ../apr-1.5.2*
######Compile and install apr-util-1.5.4.tar.gz
[root@localhost ~]# tar zxf apr-util-1.5.4.tar.gz && cd apr-util-1.5.4
[root@localhost apr-util-1.5.4]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/
[root@localhost apr-util-1.5.4]# make && make install
[root@localhost apr-util-1.5.4]# cd .. && rm -rf apr-util-1.5.4*
######Compile and install pcre-8.38.tar.gz
[root@localhost ~]# tar zxf pcre-8.38.tar.gz && cd pcre-8.38
[root@localhost pcre-8.38]# ./configure --prefix=/usr/local/pcre
[root@localhost pcre-8.38]# make && make install
[root@localhost pcre-8.38]# cd .. && rm -rf pcre-8.38*
compiling and installing httpd-2.4.17
[Root@localhost ~]# tar zxf httpd-2.4.17.tar.gz && cd httpd-2.4.17
[root@localhost httpd-2.4.17]#./ Configure--prefix=/usr/local/apache--with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util--with-pcre=/ Usr/local/pcre
[root@localhost httpd-2.4.17]# make && make install
[root@localhost httpd-2.4.17]# CD. && RM-RF httpd-2.4.17*
Configure Apache
Set Apache on boot, add Apache to Linux service
[Root@localhost init.d]# vi/usr/local/apache/conf/httpd.conf
1. Search servername www.example.com:80 Remove the preceding comment
2. Modify the DocumentRoot to/home/htdocs, and the following sentence in the line <directory to/home/htdocs
This is the WWW root setting
[root@localhost Apache] # cp/usr/local/apache/bin/apachectl/etc/init.d/httpd
[root@localhost init.d]# VI httpd
Add the following two lines of text below the first line
# Comments to support Chkconfig on RedHat Linux
# chkconfig:2345
# description:http Server
Register the service
[ro Ot@localhost init.d]# chkconfig--add httpd #self-starting under the boot model
[root@localhost init.d]# chkconfig httpd on # 345 boot mode self-booting
Run Apache
[root@localhost init.d]# service httpd start
##### #check the status of operating
[root@localhost init.d]# ps-aux | grep httpd
In host browser, enter the IP of Linux to
appear
It works!
Reference URL
Http://linux.it.net.cn/CentOS/server/webserver/2015/0320/14007.html