`
sillycat
  • 浏览: 2553023 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Apache2.2.22 On Ubuntu and Settings

 
阅读更多
Apache2.2.22 On Ubuntu and Settings

Install that On my Virtual Machine
Install Zlib
> wget http://www.zlib.net/zlib-1.2.11.tar.gz
> tar -xvf zlib-1.2.11.tar.gz
> cd zlib-1.2.11/
> ./configure --prefix=/usr/local/
> make
> sudo make install

Install HTTP Apache2.2.22
> wget http://archive.apache.org/dist/httpd/httpd-2.2.22.tar.gz
> tar -xvf httpd-2.2.22.tar.gz
> cd httpd-2.2.22/
> ./configure --prefix=/usr/local/apache2 --enable-mods-shared=all --enable-deflate --enable-proxy --enable-proxy-balancer --enable-proxy-http
> make
> sudo make install

Start the HTTP Server
> sudo /usr/local/apache2/bin/apachectl start

Visit the page
http://ubuntu-master/

Check status is not working
> sudo /usr/local/apache2/bin/apachectl status
/usr/local/apache2/bin/apachectl: 94: /usr/local/apache2/bin/apachectl: lynx: not found

Install lynx
> sudo apt-get install lynx

Still not working
> sudo /usr/local/apache2/bin/apachectl status
                                   Not Found
   The requested URL /server-status was not found on this server.

Check the configuration File
> sudo vi  /usr/local/apache2/conf/httpd.conf
LoadModule status_module modules/mod_status.so
ExtendedStatus On
<Location /server-status>
  SetHandler server-status
  Order allow,deny
  Allow from all
</Location>

Restart the Service
> sudo /usr/local/apache2/bin/apachectl restart

Then it works
> sudo /usr/local/apache2/bin/apachectl status
                       Apache Server Status for localhost
   Server Version: Apache/2.2.22 (Unix) DAV/2
   Server Built: Jun 25 2018 11:15:17
     __________________________________________________________________
   Current Time: Monday, 25-Jun-2018 11:32:29 CDT
   Restart Time: Monday, 25-Jun-2018 11:30:59 CDT
   Parent Server Generation: 0
   Server uptime: 1 minute 30 seconds
   Total accesses: 1 - Total Traffic: 2 kB
   CPU Usage: u0 s0 cu0 cs0
   .0111 requests/sec - 22 B/second - 2048 B/request
   1 requests currently being processed, 4 idle workers

Apache Proxy - Forward - Reverse
Forward - proxy the request to target server, add cache or etc.
Reverse - proxy the request to the service behide the firewall.
Eg:
    ProxyPass             /log http://192.168.8.7:8550/logman
    ProxyPassReverse    /log http://192.168.8.7:8550/logman
    #keep the session
    ProxyPassReverseCookiePath /logman /log

If I directly install the Apache2 on Ubuntu, it is the latest Version
> sudo apt-get install apache2
> apache2 -version
Server version: Apache/2.4.18 (Ubuntu)
Server built:   2018-04-18T14:53:04

Prepare Mock Server
> sudo apt-get update
> sudo apt-get install python3-pip

Install Flask
> sudo pip install flask

> cat backend1.py
from flask import Flask
app = Flask(__name__)
@app.route('/')
def home():
    return 'hello, sillycat!'

Start the Mock Service
> FLASK_APP=./backend1.py flask run --port=8080 >/dev/null 2>&1 &

Check that with Curl Command
> curl -G http://localhost:8080
hello, sillycat!


We can start some other mock services as well.
> FLASK_APP=./backend2.py flask run --port=8081 >/dev/null 2>&1 &

Running on 0.0.0.0 HOST
> FLASK_APP=./backend1.py flask run --host=0.0.0.0 --port=8080 >/dev/null 2>&1 &

Open the logging on Stage
LoadModule dumpio_module modules/mod_dumpio.so
DumpIOInput On
DumpIOOutput On
DumpIOLogLevel debug
LogLevel debug

Then we can see all the logging from here 
>tail -f /opt/apache2/logs/error_log

This Proxy Worked Pretty well
<VirtualHost *:80>
  ProxyPreserveHost On
  ProxyPassMatch "^/(.*).php$" "http://ubuntu-master:8082/$1"
  ProxyPassReverse "^/(.*).php$" "http://ubuntu-master:8082/$1"
  ProxyPass /sillycat http://ubuntu-master:8080
  ProxyPassReverse /sillycat http://ubuntu-master:8080
</VirtualHost>

http://localhost/sillycat will proxy to ubuntu-master:8080

http://localhost/kiko.php will proxy to ubuntu-master:8082/kiko

HTTPS Proxy
--enable-ssl --enable-so
> ./configure --prefix=/usr/local/apache-2.2.22 --enable-mods-shared=all --enable-deflate --enable-proxy --enable-proxy-balancer --enable-proxy-http --enable-ssl --enable-so

Make and make install to install that version, Configure the SSL proxy
<VirtualHost *:443>
  ProxyRequests Off
  ProxyPreserveHost Off
  SSLEngine on
  SSLProxyEngine on
  SSLProxyVerify none
  SSLProxyCheckPeerCN off
  SSLProtocol all -SSLv2 -SSLv3
  SSLHonorCipherOrder on
  SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS"
  SSLProxyProtocol -all +TLSv1 +TLSv1.2
  SSLProxyCipherSuite HIGH:MEDIUM:!MD5:!RC4
  ServerName manage5.xxxxxxxxx.com
  ProxyPassMatch "^/(.*)" "https://xxxxxxxx.execute-api.us-west-1.amazonaws.com/stage/$1"
  ProxyPassReverse "^/(.*)" "https://xxxxxxxx.execute-api.us-west-1.amazonaws.com/stage/$1"
  RequestHeader set X-Forwarded-Proto "https"
  SSLCertificateFile /opt/ssl/cert-stage.pem
  SSLCertificateKeyFile /opt/ssl/cert-stage.key
</VirtualHost>


Check Apache Version and OpenSSL version
> openssl version
OpenSSL 1.0.1 14 Mar 2012

> apache2 -version
Server version: Apache/2.2.22 (Ubuntu)
Server built:   Jul 24 2015 17:25:54

Test the HTTPS hand shake
> openssl s_client -connect xxxx.execute-api.us-west-1.amazonaws.com:443 -ssl3

Same issue
> curl -v -3 --ssl https://xxxxxxx.execute-api.us-west-1.amazonaws.com/stage/getPairedDevices

It seems that it can not support TLSv1.2 to proxy to API gateway. Still working on that.

Try to upgrade the APACHE Version
http://archive.apache.org/dist/httpd/httpd-2.2.34.tar.gz

Check the linked SSL version
> ldd /usr/local/apache-2.2.34/modules/mod_ssl.so
linux-vdso.so.1 =>  (0x00007ffd3a991000)
libssl.so.1.0.0 => /lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007fd300d46000)
libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007fd300902000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fd3006e5000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd30031b000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fd300117000)
/lib64/ld-linux-x86-64.so.2 (0x00007fd3011e0000)

Check the openssl library
> openssl version -a
OpenSSL 1.0.2g  1 Mar 2016
built on: reproducible build, date unspecified
platform: debian-amd64
options:  bn(64,64) rc4(16x,int) des(idx,cisc,16,int) blowfish(idx)
compiler: cc -I. -I.. -I../include  -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -m64 -DL_ENDIAN -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wa,--noexecstack -Wall -DMD32_REG_T=int -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM
OPENSSLDIR: "/usr/lib/ssl"


Some Options
-ssl2         - just use SSLv2
-ssl3         - just use SSLv3
-tls1_2       - just use TLSv1.2
-tls1_1       - just use TLSv1.1
-tls1         - just use TLSv1
-dtls1        - just use DTLSv1

> ./configure --prefix=/usr/local/apache-2.2.34 --enable-mods-shared=all --enable-deflate --enable-proxy --enable-proxy-balancer --enable-proxy-http --enable-ssl --enable-so --with-ssl=/usr/lib/ssl --enable-ssl-staticlib-deps --enable-mods-static=ssl


> sudo apt-get install libapr1-dev libaprutil1-dev
> sudo apt-get install libpcre3-dev

Try with latest version 2.4.9
> ./configure --prefix=/usr/local/apache-2.4.9 --enable-mods-shared=all --enable-deflate --enable-proxy --enable-proxy-balancer --enable-proxy-http --enable-ssl --enable-so --with-ssl=/usr/lib/ssl --enable-ssl-staticlib-deps --enable-mods-static=ssl
Make and Make install

In version 2.4.9, need open more module
LoadModule slotmem_shm_module modules/mod_slotmem_shm.so

Version 2.4.9, It will work perfectly
DumpIOInput On
DumpIOOutput On
LogLevel debug
<VirtualHost *:443>
  ProxyRequests Off
  ProxyPreserveHost Off
  SSLEngine on
  SSLProxyEngine on
  SSLProxyVerify none
  SSLProxyCheckPeerCN off
  SSLProtocol all -SSLv2 -SSLv3
  SSLHonorCipherOrder on
  SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS"
  SSLProxyProtocol -all +TLSv1 +TLSv1.2
  SSLProxyCipherSuite HIGH:MEDIUM:!MD5:!RC4
  ServerName manage5.sillycatcloudbeta.com
  ProxyPassMatch "^/api/(.*)" "https://xxxxx.execute-api.us-west-1.amazonaws.com/stage/$1"
  ProxyPassReverse "^/api/(.*)" "https://xxxxx.execute-api.us-west-1.amazonaws.com/stage/$1"
  RequestHeader set X-Forwarded-Proto "https"
  SSLCertificateFile /opt/ssl/cert-stage.pem
  SSLCertificateKeyFile /opt/ssl/cert-stage.key
</VirtualHost>


References:
http://archive.apache.org/dist/httpd/
https://askubuntu.com/questions/574266/install-apache-2-2-22-on-ubuntu-14-04
https://techjourney.net/request-url-server-status-or-404-page-not-found-apache-httpd-error/
http://www.micmiu.com/enterprise-app/server/apache-proxy-demo/
http://blog.sina.com.cn/s/blog_4da051a60102vf3f.html
https://www.oschina.net/question/12_2803
https://serverfault.com/questions/577734/apache-proxy-an-internal-url-using-regex
https://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypassmatch
https://blog.csdn.net/fenglibing/article/details/6796094
http://agapple.iteye.com/blog/807101
https://www.digitalocean.com/community/tutorials/how-to-use-apache-as-a-reverse-proxy-with-mod_proxy-on-ubuntu-16-04
https://serverfault.com/questions/248918/how-can-i-enable-logging-for-requests-going-through-mod-proxy/542039
http://flask.pocoo.org/docs/0.12/quickstart/
https://www.thegeekstuff.com/2011/03/install-apache2-ssl/

https://forums.aws.amazon.com/thread.jspa?threadID=246053
https://stackoverflow.com/questions/41386827/apache-disable-sslv3-with-sslproxyprotocol-not-working
https://www.openssl.org/news/changelog.html
https://github.com/mozilla/server-side-tls/issues/62
https://serverfault.com/questions/314858/how-to-enable-tls-1-1-and-1-2-with-openssl-and-apache
http://archive.apache.org/dist/httpd/
https://askubuntu.com/questions/168731/problem-to-install-apache-2-4-2-in-ubuntu-12-04
分享到:
评论

相关推荐

    apache2.2.22for linux

    对于想要安装或管理Apache 2.2.22 on Linux的用户,首先要确保系统满足最低硬件需求,然后下载适合Linux发行版的二进制包或源代码包进行编译安装。安装过程中需要配置端口号、文档根目录、虚拟主机等设置,并根据...

    Apache2.2.22+jk+tomcat7集群全套资料

    Apache 2.2.22、JK模块与Tomcat 7是构建高性能Web服务集群的关键组件。Apache HTTP服务器作为前端负载均衡器,通过JK模块(也称为mod_jk)与后端的Tomcat应用服务器进行通信,实现动态内容的处理。这种架构允许你将...

    Apache2.2.22

    在安全方面,Apache 2.2.22包含了一些重要的安全修复。例如,它修复了可能导致远程代码执行、信息泄露和拒绝服务攻击的漏洞。这些修复对于维护服务器的安全性至关重要,尤其是对于公开访问的网站。 配置Apache ...

    Win2003+Apache2.2.22+PHP5.4安装配置详细教程

    - 这是Apache 2.2.22的Windows二进制发行版,内置OpenSSL支持,适用于32位Windows系统。 2. **PHP**:`php-5.4.0-Win32-VC9-x86.zip` - PHP 5.4.0的Windows二进制发行版,使用Visual C++ 2008编译,适用于32位...

    apache 2.2.22

    这个版本(2.2.22)是Apache 2.x系列的一部分,提供了许多改进和新特性,以提高性能、安全性和稳定性。 Apache HTTP Server的主要功能包括: 1. **多平台支持**:Apache可以在多种操作系统上运行,如Windows、Unix...

    Windows XP下Apache2.2.22 + php5.2.17 + mysql5详细配置.docx

    访问 Apache 官方网站,下载 Apache2.2.22 的安装包。 2. 安装 Apache 双击下载的安装包,按照提示安装 Apache。安装时,需要选择安装路径和端口号。这里,我们选择典型的安装方式,并将安装路径设置为 C:\Apache...

    PHP5.2.6+Apache2.2.22组合套装下载

    Apache2.2.22还支持多种操作系统,包括Windows、Linux、Unix等,使其成为跨平台Web服务的首选。 将PHP和Apache结合使用,可以形成一个强大的Web服务器环境,称为LAMP(Linux、Apache、MySQL、PHP)或WAMP(Windows...

    Windows XP下安装和配置Apache2.2.22服务器+PHP5+Mysql5.docx

    Windows XP 下安装和配置 Apache 2.2.22 服务器 + PHP 5 + Mysql 5 本文将指导读者在 Windows XP 环境下安装和配置 Apache 2.2.22 服务器、PHP 5 和 Mysql 5,旨在帮助读者快速搭建 PHP 开发环境,以便进行本地测试...

    LAMP源码安装(Apache 2.2.22、PHP 5.2.17、Mysql 5.6)

    Apache 2.2.22、PHP 5.2.17、Mysql 5.6 源码安装下载 编译安装参看:https://blog.csdn.net/Hynial/article/details/82057033

    Apache2.2.22+Subversion1.5.3+TortoiseSVN1.5(apache SVN部署全套包)

    Apache2.2.22+Subversion1.5.3+TortoiseSVN1.5(apache SVN部署全套包),博客在http://blog.csdn.net/kimizhou_blog/article/details/7481959

    apache-2.2.22

    Apache-2.2安装包 官方正版

    Linux(RedHat)+php5.3.10+mysql5.5.19+apache2.2.22安装配置说明.

    本教程将详细介绍如何在Red Hat Enterprise Linux环境下,搭建一个基于LAMP(Linux、Apache、MySQL、PHP)架构的web服务器,使用的是PHP5.3.10、MySQL5.5.19和Apache2.2.22这三个组件。 首先,我们需要准备Linux ...

    Windows 8下安裝配置Apache 2.2.22+MySQL 5.5.21+PHP 5.4.0服務器環境教程

    在本教程中,我们将深入探讨如何在Windows 8操作系统下安装和配置Apache 2.2.22、MySQL 5.5.21以及PHP 5.4.0,最终搭建一个完整的LAMP(Linux Apache MySQL PHP)环境的变体——WAMP(Windows Apache MySQL PHP)...

    apache_2.2.22-x64-openssl-1.0.0g.msi

    带有编译好openssl的apache

    apache_2.2.22

    1. **模块化设计**:Apache 2.2.22采用模块化设计,允许用户根据需求选择加载或卸载特定的功能模块。例如,mod_rewrite用于URL重写,mod_security用于增强安全性,mod_deflate用于内容压缩,mod_proxy则用于代理和...

    Windows 8下安装配置Apache 2.2.22+MySQL 5.5.21+PHP 5.4.0服务器环境教程.doc

    在本教程中,我们将详细介绍如何在Windows 8操作系统上安装并配置Apache 2.2.22、MySQL 5.5.21和PHP 5.4.0服务器环境,以及如何添加PhpMyAdmin用于数据库管理。这个组合通常被称为LAMP(Linux、Apache、MySQL、PHP)...

    安装apache2.2.22配置php5.4(具体操作步骤).docx

    在本文档中,我们详细介绍了如何在服务器上安装Apache 2.2.22并配置PHP 5.4。这是一个重要的步骤,对于那些需要搭建基于PHP的Web应用程序平台的用户来说,例如WordPress或其他PHP驱动的网站。以下是安装和配置过程的...

    apache2-2.2.22-i586.rpm

    Linux 下apache2-2.2.22-i586.rpm 快速安装包

    完整的linux(RedHat)+php5.3.10+mysql5.5.19+apache2.2.22安装配置说明

    **对于Ubuntu系统:** ```bash # apt-get install libncurses5 libncurses5-dev ``` 3. **清除CMake缓存并重新运行CMake:** ```bash # rm -rf CMakeCache.txt # cmake . ``` #### 二、Apache安装与配置 ...

Global site tag (gtag.js) - Google Analytics