HTTP2配置 - Apache Tomcat - Mac

时间:2017-04-05 06:40:24

标签: apache http2

任何人都可以告诉我如何在Apache Tomcat Server上配置HTTP2。

2 个答案:

答案 0 :(得分:4)

这是我前一段时间写给tomcat邮件列表的开发人员安装指南:Link to mailing list post

  1. 从AppStore下载XCode
  2. 安装Brew:http://brew.sh/
  3. 下载Apache Tomcat二进制文件> 8.5 http://tomcat.apache.org/
  4. 使用“brew install openssl”和“brew install”安装APR和OPENSSL 四月”
  5. 在“apache-tomcat-8.5.15 / conf”文件夹中创建pem文件 - 使用“changeit” 每次要求输入密码时(命令都可以 单独执行或在shell脚本中执行):

    • /usr/local/Cellar/openssl/1.0.2l/bin/openssl genrsa -des3 -out localhost-rsa-key 1024
    • /usr/local/Cellar/openssl/1.0.2l/bin/openssl genrsa -out localhost-key 1024
    • /usr/local/Cellar/openssl/1.0.2l/bin/openssl rsa -in localhost-rsa-key -out 本地主机密钥
    • /usr/local/Cellar/openssl/1.0.2l/bin/openssl req -new -key localhost-key -out localhost-csr
    • /usr/local/Cellar/openssl/1.0.2l/bin/openssl x509 -req -days 365-in localhost-csr -signkey localhost-key -out localhost-crt
    • cat localhost-key localhost-crt>本地主机 - RSA-cert.pem
    • cat localhost-rsa-cert.pem>本地主机 - RSA-chain.pem
    • cat localhost-rsa-key>本地主机-RSA密钥-mod.pem
    • /usr/local/Cellar/openssl/1.0.2l/bin/openssl rsa -in localhost-rsa-key-mod.pem -out localhost-rsa-key.pem
  6. 使用协议取消注释http / 2连接器 “org.apache.coyote.http11.Http11AprProtocol”中 “Apache的Tomcat的8.5.15 / CONF / server.xml中”

  7. Tomcat本机安装
    • 提取“apache-tomcat-8.5.15 / bin / tomcat-native.tar.gz”
    • 进入文件夹“apache-tomcat-8.5.15 / bin / tomcat-native-1.2.12-src / native”
    • 运行“./configure --with-apr = / usr / local / Cellar / apr / 1.5.2_3 / --with-SSL =的/ usr /本地/地窖/ OpenSSL的/ 1.0.2l”
    • 运行“make”
  8. 在/ bin文件夹中创建一个setenv.sh文件并添加以下行:

    • LD_LIBRARY_PATH = $ LD_LIBRARY_PATH:/usr/local/Cellar/apr/1.5.2_3/libexec/lib:/Applications/apache-tomcat-8.5.15/bin/tomcat-native-1.2.12-src/native/的.libs
    • JAVA_OPTS =“ - Djava.library.path =的/ usr /本地/地窖/ APR / 1.5.2_3 /的libexec / lib中:/Applications/apache-tomcat-8.5.15/bin/tomcat-native-1.2.12 -src /天然的/的.libs“
  9. 启动服务器

  10. 日志:

    01-Jun-2017 09:32:46.551 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library [1.2.12] using APR version [1.5.2].
    01-Jun-2017 09:32:46.551 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
    01-Jun-2017 09:32:46.551 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
    01-Jun-2017 09:32:46.556 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 1.0.2l  25 May 2017]
    
    • 注意:路径可能会根据openssl /的版本进行调整 apr / tomcat-native / tomcat version

答案 1 :(得分:1)

由于您还没有写过您已经尝试过的内容,我建议您先从Apache's guide开始。它解释了如何使用HTTP / 2模块编译Apache(它仍然是实验性的,因此默认情况下它没有启动)和配置过程