(1) Download the installation package to /home/proxy/temp/, and then decompress it
apr, apr-util download address http://archive.apache.org/dist/apr, http://www.apache.org/dist/apr/
pcre download address ftp://ftp.csx.cam.ac. uk/pub/software/programming/pcre/, http://ftp.pcre.org/pub/pcre/
httpd download address https://archive.apache.org/dist/httpd/, http://www.apache .org/dist/httpd/
mod_wl_24.so download link https://www.oracle.com/technetwork/middleware/webtier/downloads/index-jsp-156711.html
tar -zxvf apr-1.4.6.tar.gz
tar -zxvf apr-util-1.5.2.tar.gz
tar -zxvf pcre-8.38.tar.gz
tar -zxvf httpd-2.2.29.tar.gz
if not (gcc, gcc-c++, expat-devel, penssl- devel) install
yum -y install gcc
yum -y install gcc-c++
yum install expat-devel
yum -y install mod_ssl openssl-devel
(2) Compile and install apr
cd apr-1.4.6
./configure --prefix=/home/app/deploy/apr/ #The installation is named apr under /home/app/deploy
make
make install
(3) Compile and install apr-util
cd apr-util-1.5.2
./configure --prefix=/home/app/deploy/apr-util --with-apr=/home/app/deploy/apr
make
make install
(4) Compile and install pcre
cd pcre-8.38
./configure --prefix=/home/app/deploy/pcre
make
make install
So far basically resolved the dependencies.
(5) Compile and install httpd-2.2.15
cd httpd-2.2.15
./configure --prefix=/home/app/deploy/apache --sysconfdir=/home/app/deploy/apache/conf --enable-so --enable-rewirte --enable-ssl --enable-cgi --enable-cgid --enable-modules=most --enable-mods-shared=most --enable-mpms-shared=all --with-apr=/home/app/deploy/apr - -with-apr-util=/home/app/deploy/apr-util
make
make install
Note: There are differences between versions of apache, if there is a problem (./configure --prefix=/home/app/deploy/apache --sysconfdir =/home/app/deploy/apache/conf --enable-so --enable-rewirte --enable-ssl --enable-cgi --enable-cgid --enable-modules=most --enable-mods-shared =most --enable-mpms-shared=all --with-apr=/home/app/deploy/apr --with-apr-util=/home/app/deploy/apr-util --with-pcre=/ home/app/deploy/pcre)
explanation:
--enable-so: supports dynamic shared modules, if it supports php, it will not work with apache. must have
--enable-ssl: enable ssl function, if not enabled, you will not be able to use https
--enable-mpms-shared=all: prefork, worker, event
--with-mpm=event: event is the default
--enable-rewrite: support URL rewriting
--enable-cgi: support cgi
--enable-cgid: httpd uses event or worker to enable thread access
--enable-modules=most: enable most modules
--enable-mods-shared=most: Enable most shared modules
(6) Start and stop services
start
/home/app/deploy/apache/bin/httpd -k start -f /home/app/deploy/apache/conf/httpd.conf
stop
/home/app/deploy/apache/bin/httpd -k stop -f /home/app/deploy/apache/conf/httpd.conf
(7) Install optional modules separately
1. First locate the proxy directory of the Apache source code
# cd /home/proxy/temp/httpd-2.2.15
# cd modules/proxy
2. Compile the corresponding module:
where "/home/app/deploy/apache" is the previous Apache installation manual
# /home/app/deploy/apache/bin/apxs -c -i mod_proxy.c proxy_util.c
Load module:
# /home/app/deploy/apache/bin/apxs -i -a -n proxy mod_proxy.la
In this way, the proxy is successfully installed, and you can see that the following statement is automatically added in httpd.conf:
LoadModule proxy_module modules/mod_proxy.so
module The corresponding mod_proxy.so module is also generated in the module folder
However, proxy is only a core module, and when it is to be used specifically, it is necessary to add corresponding modules, and the method is similar.
For example, the author wants to use ProxyPass, ProxyPassReverse,
then http is needed, so continue to compile and add the following modules:
# /home/app/deploy/apache/bin/apxs -c mod_proxy_http.c
# /home/app/deploy/apache/bin/apxs -i -a -n proxy_http mod_proxy_http.la
(8) Reverse proxy configuration
NameVirtualHost *:8080
<VirtualHost *:8080>
ServerAdmin *****@***.com
DocumentRoot /home/apache/docs/
SSLCertificateFile "/home/apache/crt/server.crt"
SSLCertificateKeyFile "/home/apache/crt/server.key"
ErrorLog /home/apache/logs/http-error.log
CustomLog /home/apache/logs/http.log common
<Directory "/home/apache/docs/">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
SSLEngine On
SSLProxyEngine On
ProxyRequests Off
ProxyPreserveHost On
#https转http
ProxyPass /app/ http://*.*.*.*:8080/app/
ProxyPassReverse /app/ http://*.*.*.*:8080/app/
#https转https
ProxyPass /app/ https://*.*.*.*:8080/app/
ProxyPassReverse /app/ https://*.*.*.*:8080/app/
</VirtualHost>
(9) Forward proxy configuration
NameVirtualHost *:8080
<VirtualHost *:8080>
ServerAdmin *****@***.com
ServerName netconnectapp
DocumentRoot /home/apache/docs/
ServerAlias testapp
ErrorLog /home/apache/logs/http-error.log
CustomLog /home/apache/logs/http.log common
<Directory "/home/apache/docs/">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
#Forward proxy settings
ProxyRequests On
ProxyVia On
Timeout 30
KeepAlive On
MaxKeepAliveRequests 500
KeepAliveTimeout 30
AllowCONNECT 443 563 5000 80
<Proxy *>
Order Deny,Allow
Deny from all
Allow from all
</Proxy>
</VirtualHost>