Compile and install Apache in CentOS
Compile and install Apache in CentOS
Uninstall the original apache
First download the apachesource code package httpd-2.4.4.tar.gz from the http://httpd.apache.or
Then download apr-1.4.6.tar.gzand apr-util-1.5.1.tar.gz from the http://apr.apache.org
Then download pcre-8.32.tar.gzand pcre-devel-8.32.tar.gz from http://sourceforge.net/
First install gcc and make
Yum-y install gcc
Yum-y install make
Yum-y install gcc-c ++ does not have this gcc-c ++.
Switch to the downloaded source code package directory. I am ~ /Download
Install apr:
Tar-zvxf apr-1.4.6.tar.gz
Cd apr-1.4.6
./Configure -- prefix =/usr/local/apr
Make & make install
Install apr-util
Tar-zvxf apr-util-1.5.1.tar.gz
Cd apr-util-1.5.1
./Configure -- prefix =/usr/local/apr-util -- with-apr =/usr/local/apr
Make & make install
Install pcre
Tar-zvxf pcre-8.32.tar.gz
Cd pcre-8.32
./Configure
Make & make install
Install pcre-devel
If you have already installed pcre, you must install it.
Tar-zxvf pcre-devel-8.32.tar.gz
Cd pcre-devel-8.32
./Configure
Make & make install
To install apache, you must first install the three above. Otherwise, the compilation will fail.
Tar-zvxf httpd-2.4.4.tar.gz
Cd httpd-2.4.4
./Configure -- prefix =/usr/local/apache-with-apr =/usr/local/apr -- with-apr-util =/usr/local/apr-util
Make & make install
Configure the http. conf file under/usr/local/apache/conf (backup first ).
1. Servers
# ServerName www.example.com: Delete the # Before 80.
2. directory access permission
<Directory/>
Options FollowSymLinks
AllowOverride None
Order deny, allow
Allow from all # modify this example
</Directory>
3. Default Character Set
Adddefacharcharset UTF-8 # specify the default Character Set
4. Start httpd
Cd bin/
./Apachectl start | restart | stop
Add httpd as a system service
Cp apachectl/etc/init. d/httpd
/Etc/init. d/
Edit httpd and add the following information to the second line:
# Chkconfig: 345 85 15
# Description: Activates/Deactivates Apache Web Server
The preceding two statements must be added. Otherwise, the system prompts "httpd service not supported". The three numeric parameters in the first line indicate the Linux-level httpd (, 5) to be started ); start No. (85); close no. (15 ).
Add startup information (difference between Ubuntu and CentOS)
Chkconfig-add httpd
Check whether the configuration is successfully added.
Chkconfig -- list
Server Control
Service httpd start | restart | stop
Install a Web Server on Ubuntu Server 14.04 (Linux + Apache + MySQL + PHP)
Install and configure the PHP environment in Linux (Apache2)
Install the LAMP \ Vsftpd \ Webmin \ phpMyAdmin service and settings in Ubuntu 13.04
Compile and install LAMP in CentOS 5.9 (Apache 2.2.44 + MySQL 5.6.10 + PHP 5.4.12)
Source code for Web server architecture in RedHat 5.4 build the LAMP environment and application PHPWind
Apache details: click here
Apache: click here
This article permanently updates the link address: