[CentOS] How to compile and install Apache from source code
How to compile and install Apache from source code in CentOS
-
Download the latest Apache version
wget http://mirror.downloadvn.com/apache//httpd/httpd-2.4.41.tar.gz
- Install package
yum install apr* gcc - Compile and install
tar -zxvf httpd-2.4.41.tar.gz
cd httpd-2.4.41
./configure –prefix=/usr/local/apache –enable-vhost-alias –enable-rewrite –enable-info
make
make install
Copy the initialization file and set Apache to boot
cp build/rpm/httpd.init /etc/init.d/httpd
chmod 755 /etc/init.d/httpd
chkconfig –add httpd
chkconfig –level 35 httpd on
Create a symbolic link
ln -s /usr/local/apache/ httpd
cd /usr/sbin/
ln -fs /usr/local/apache/bin/httpd
ln -fs /usr/local/apache/bin/apachectl
cd /var/log
rm -rf httpd/
/etc/init.d/httpd start
Start/stop httpd service
service httpd restart
service httpd start
/usr/local/apache/bin/apachectl start
/usr/local/apache/bin/apachectl stop
/usr/local/apache/bin/apachectl status
/etc/init.d/httpd start
/etc/init.d/httpd stop
/etc/init.d/httpd restart
Use pgrep to find started processes
pgrep httpd
Apache configuration file
vi /usr/local/apache/conf/httpd.conf