Source code compiled under CentOS install httpd

Best installation components
[root@localhost ~]# yum groupinstall additional development
[root@localhost ~]# yum groupinstall development tool
2 install AP1.5.2R (Apache Portable Runtime), install apr-util 1.5.4 tools
[root@localhost ~]wget http://mirrors.cnnic.cn/apache//apr/apr-1.5.2.tar.gz
[root@localhost ~]# tar xzvf apr-1.5.2.tar.gz
[root@localhost apr-1.5.2]# ./configure –prefix=/usr/local/apr/
If an error: RM:cannot remove ‘libtoolT’: No such file or directory, edit the configure this file will $RM $cfgfile line commented out
[root@localhost apr-1.5.2]#make&&make install
Install the apr-util tool
[root@ns2 ~]wget http://mirrors.cnnic.cn/apache//apr/apr-util-1.5.4.tar.gz
Compilation options note that there–Apr options
[root@localhost ~]# tar xf apr-util-1.5.4.tar.gz
[root@localhost ~]# 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
3 CentOS PCRE is installed by default, so there’s no need to install PCRE, or install
4 install the httpd 2.4.12 (new 2015-6-6)
[root@localhost ~]# tar xf httpd-2.4.12.tar.bz2
[root@localhost ~]# cd httpd-2.4.12
Intend to compile options plus (note that the ambiguous view./don’t write, finish and their control, whether there is a problem)
Basic options, including installation, the configuration file path
–Prefix=/usr/local/Apache specifies the installation path
–Sysconfdir=/etc/httpd specifies the path of the configuration file
Modules allow option, allow the module to use, most developments allow the MPM
–Enable-so allow the module to use
–Enable-modules=most added the majority of modules
–enable-mods-shared=most
–Enable-MPMs-shared=all supports all MPM models
–Enable-CGI–enable-cgid CGI program
–Enable-SSL supports SSL to support HTTPS
–Enable-rewrite support for URL redirection
Specify and APR,apr-util contact and binding
–with-include-apr
–With-Apr=/usr/local/Apr specifies the APR
–With-apr-util=/usr/local/apr-util specified apr-util


[root@localhost httpd-2.4.12]# ./configure –prefix=/usr/local/apache –sysconfdir=/etc/httpd –enable-so –enable-modules=most –enable-mods-shared=most –enable-mpms-shared =all –enable-cgi –enable-cgid –enable-ssl –enable-rewrite –with-include-apr –with-apr=/usr/local/apr –with-apr-util=/usr/local/apr-util
[root@localhost httpd-2.4.12]#make&&make install
Compilation installation
After entering the installation directory
[root@localhost bin]# cd /usr/local/apache
[root@localhost apache]# ls
bin build cgi-bin error htdocs icons include logs man manual modules
[root@localhost apache]# cd bin/
[root@localhost bin]# ./apachectl
Try it and then open a Web page, enter the IP of your virtual machine
If you can’t open, consider the following
[root@localhost bin]# service iptables stop
[root@localhost bin]# getenforce
Enforcing
[root@localhost bin]# setenforce 0
[root@localhost bin]# vim /etc/selinux/config
To permissive
Modify the folder properties
[root@localhost bin]#chmod 755 /usr/local/apache/
Try refreshing
Above right, a page it appears works! Rear
We can copy the command to the/etc/init.d/httpd implementation service called, in short, all in order to use httpd prior to implementation of RPM packages that habit, hehe
[root@localhost bin]# cp /root/httpd-2.4.12/build/rpm/httpd.init /etc/init.d/httpd
[root@localhost bin]# chmod +x /etc/init.d/httpd
Modify the file
Recommendation III
httpd=${HTTPD-/usr/local/apache/bin/httpd}
pidfile=${PIDFILE-/var/run/httpd/${prog}.pid}
CONFFILE=/etc/httpd/httpd.conf
Don’t enable services
Create the appropriate directory
[root@localhost bin]# mkdir /var/run/httpd/
In order to use the command, modify the ~/.bash_profile
Changed to PATH=$PATH:$HOME/bin:/usr/local/apache/bin
[root@localhost bin]# vim ~/.bash_profile
[root@localhost bin]# source ~/.bash_profile
[root@localhost bin]# httpd -t
Syntax OK
In the/etc/httpd/httpd.conf add this line
PidFile “/var/run/httpd/httpd.pid”
Linked for log file creation
[root@localhost bin]# ln -s /usr/local/apache/logs/* /var/log/httpd/
And then restart the service to see if OK
If you can’t view the log file
[root@localhost bin]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
And then view the page again is normal, eventually building new httpd2.4.12 task has been completed!