1 Introduction
Compile and install Apache HTTP Server, the latest version is 2.4.41, good compiler can be installed after apr, apr-util, pcre installation.
2 Preparations
Three: apr, apr-util, pcre, installed can be skipped.
2.1 apr
Download: Link
tar -zxvf apr-1.7.0.tar.gz
cd apr-1.7.0
./configure --prefix=/usr/local/apr/apr
make
sudo make install
Custom installation location.
2.2 in April-util
Download: Link
tar -zxvf apr-util-1.6.1.tar.gz
cd apr-util-1.6.1
./configure --prefix=/usr/local/apr/util --with-apr=/usr/local/apr/apr
Custom installation location, if apr Also, if changed in the last step needed to use the default installation location
--with-apr
Apr specify the installation location of the custom.
Then compile and install:
make
sudo make install
2.3 pcre
Download: Link
tar -zxvf pcre-8.44.tar.gz
cd pcre-8.44
./configure --prefix=/usr/local/pcre
make
sudo make install
3 Apache
3.1 Download
3.2 unzip
tar -zxvf httpd-2.4.41.tar.bz2
cd httpd-2.4.41
3.3 Installation
./configure --prefix=/usr/local/httpd
Because modify the default installation location of the apr, apr can not find here tips, so use
./configure --help
Look at options for help.
But it needs a lot of options regarding apr options:
./configure --help | grep -i “apr”
So add options:
./configure --prefix=/usr/local/httpd \
--with-apr=/usr/local/apr/apr \
--with-apr-util=/usr/local/apr/util
If pcre not found appears plus:
--with-pcre=/usr/local/pcre
3.4 Compile and install
make
sudo make install
3.5 modify the default configuration
vim PREFIX/conf/httpd.conf
Wherein PREFIX is the installation location. Modify the server name, port, and so on.
Search ServerName, initial configuration can be modified as follows:
ServerName localhost:80
3.6 Start Service
PREFIX/bin/apachectl -k start
PREFIX is installation location, please refuse permission to add sudo.
3.7 Test
Enter a custom browser just the ServerName:
success, here it is the installation directory htdocs / index.html.