1. Download Apache source code
[Root@mysql ~]# tar-zxvf httpd-2.4.33.tar.gz
[root@mysql httpd-2.4.33]#./configure--prefix=/usr/local/apache2/
checking for chosen layout ... Apache
checking for working mkdir-p ... yes checking for
grep that handles long lines and-e .../bin/grep chec
King for Egrep .../bin/grep-e checking build
system type ... x86_64-pc-linux-gnu
checking host system type ... x86_ 64-pc-linux-gnu
checking target system type ... x86_64-pc-linux-gnu
configure:
configure:configuring Apache Portable Runtime Library ...
Configure:
checking for APR ... Configure:WARNING:APR version 1.4.0 or later is required, found 1.3.9 configure
: warning:skipped APR at Apr-1-config, version not acceptable
no
configure:error:APR not found. Please read the documentation.
2. Install Apr
[Root@mysql apr-1.6.3]#./configure--prefix=/usr/local/apr/
Make&make Install
3. Install Apr-util
Apr_util installation relies on APR, so you need to specify the path of the APR
[Root@mysql apr-util-1.5.1]# ./configure--prefix=/usr/local/apr-util/--with-apr=/usr/local/apr/
Make&make Install
4. Install Pcre
[Root@mysql pcre-8.35]#./configure--prefix=/usr/local/pcre/
Make&make Install
5. Install Apache
[Root@mysql httpd-2.4.33]#./configure--prefix=/usr/local/apache2 --enable-so--enable-rewirte--enable-ssl-- enable-cgi--enable-cgid--enable-modules=most--enable-mods-shared=most--enable-mpms-shared=all--with-apr=/usr/ LOCAL/APR--with-apr-util=/usr/local/apr-util
Error when make
Libtool: error:cannot Find the library '/usr/local/apache2//lib/libapr-1.la ' or unhandled argument '/usr/local/ Apache2//lib/libapr-1.la '
make[2]: * * * [htpasswd] Error 1
make[2]: Leaving directory '/root/httpd-2.4.33/ Support '
make[1]: * * * [all-recursive] Error 1
make[1]: Leaving directory '/root/httpd-2.4.33/support '
Make: * * * [all-recursive] Error 1
Create a directory before compiling and copy the appropriate files from the APR to the prompt directory/usr/local/apache2/lib
[Root@mysql lib]# cp libapr-1.la/usr/local/apache2/lib
[root@mysql lib]# CP Libapr-1.so/usr/local/apache2/lib
Delete Folder Make&make Install
Start Apache
[Root@mysql bin]# apachectl start
[root@mysql bin]# service httpd status
httpd (PID 103174) is Running...
[root@mysql bin]# ps-ef|grep httpd
root 103174 1 0 14:06? 00:00:00/usr/sbin/httpd-k start
Apache 103176 103174 0 14:06? 00:00:00/usr/sbin/httpd-k start
Apache 103177 103174 0 14:06? 00:00:00/usr/sbin/httpd-k start
Apache 103178 103174 0 14:06? 00:00:00/usr/sbin/httpd-k start
Apache 103179 103174 0 14:06? 00:00:00/usr/sbin/httpd-k start
Apache 103180 103174 0 14:06? 00:00:00/usr/sbin/httpd-k start
Apache 103181 103174 0 14:06? 00:00:00/usr/sbin/httpd-k start
Apache 103182 103174 0 14:06? 00:00:00/usr/sbin/httpd-k start
Apache 103183 103174 0 14:06? 00:00:00/usr/sbin/httpd-k start
root 103201 9310 0 14:06 pts/8 00:00:00 grep httpd
Browser access
6. Install Mod_wsgi
[Root@mysql mod_wsgi-4.6.4]#./configure--with-apxs=/usr/local/apache2/bin/apxs--with-python=/usr/bin/python
Make&make Install
Error
/usr/local/python-2.7.14/lib/libpython2.7.a:could not read Symbols:bad value
collect2:ld returned 1 exit Status
apxs:error:command failed with rc=65536
.
Make: * * * [src/server/mod_wsgi.la] Error 1
This is because the installation of python2.7 did not join the--enable-shared parameter, the installation of MOD_WSGI will report the following error: "Recompile with-fpic"
Recompile installation python2.7
./configure--prefix=/usr/local/python-2.7.14-enable-shared Cflags=-fpic
Then install MOD_WSGI successfully