Apache MAMP Pro中的HTTP2支持

Apache MAMP Pro中的HTTP2支持,apache,nginx,mamp,http2,mamp-pro,Apache,Nginx,Mamp,Http2,Mamp Pro,有没有办法在MAMP Pro中启用HTTP2支持?我想用HTTP2支持测试和改进我的一些本地开发网站 我已经搜索了一段时间,但没有找到一个解决方案。如果您使用的是Nginx,您可以将以下代码添加到服务器块或http块(用于全局)到Nginx.conf中 add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"; 否则,如果Apache可以执行上述操作,则打开Nginx设置并为MAMP

有没有办法在MAMP Pro中启用HTTP2支持?我想用HTTP2支持测试和改进我的一些本地开发网站


我已经搜索了一段时间,但没有找到一个解决方案。

如果您使用的是Nginx,您可以将以下代码添加到服务器块或http块(用于全局)到Nginx.conf中

add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload";

否则,如果Apache可以执行上述操作,则打开Nginx设置并为MAMP Pro
v4.0.0启用“使用Nginx作为Apache的反向代理”

C:\>F:\MAMP\bin\nginx\nginx.exe -V
nginx version: nginx/1.13.1
built by cl 16.00.40219.01 for 80x86
built with OpenSSL 1.0.1m 19 Mar 2015
TLS SNI support enabled
configure arguments: --with-cc=cl --builddir=objs --prefix= --conf-path=conf/nginx.conf --pid-path=logs/nginx.pid --http-log-path=logs/access.log --error-log-path=logs/error.log --sbin-path=nginx.exe
--http-client-body-temp-path=temp/client_body_temp --http-proxy-temp-path=temp/proxy_temp --http-fastcgi-temp-path=temp/fastcgi_temp --with-cc-opt=-DFD_SETSIZE=1024 --with-pcre=objs/lib/pcre --with-zl
ib=objs/lib/zlib --with-openssl=objs/lib/openssl --with-select_module --with-http_ssl_module --add-module=c:/MinGW/msys/1.0/home/Nebojsa/subsmodule/ngx_http_substitutions_filter_module
Nginx不支持HTTP2

C:\>F:\MAMP\bin\apache\bin\httpd.exe -V
Server version: Apache/2.2.31 (Win32)
Server built:   May  6 2016 10:19:53
Server's Module Magic Number: 20051115:40
Server loaded:  APR 1.5.2, APR-Util 1.5.4
Compiled using: APR 1.5.2, APR-Util 1.5.4
Architecture:   32-bit
Server MPM:     WinNT
  threaded:     yes (fixed thread count)
    forked:     no
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/winnt"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=128
 -D HTTPD_ROOT="/apache"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error.log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"
如果您看看ApacheHTTP2模块

Apache模块mod_http2

可用语言:英语

描述:支持HTTP/2传输层

状态:分机

模块标识符:http2_模块

源文件:mod_http2.c

兼容性:在2.4.17及更高版本中提供

使用Apache
2.2.31
的MAMP Pro 4不符合Apache的最低版本


所以你不能使用HTTP2模块。最好通过docker使用其他较新版本的apache,或者直接使用HTTP2,因为Tarun已经声明MAMP pro中包含的apache和Nginx版本不支持HTTP/2。此外,HTTP/2需要现代版本的OpenSSL(1.0.2)来支持大多数浏览器上的HTTP/2

因此,您最好的选择是更改Apache和/或Nginx以支持此功能。然后,您可以复制适当的配置以连接到MAMP堆栈的其余部分(例如MySQL、PHP等等)

如果您使用的是Windows,则可以提供最新的Apache版本和HTTP/2支持。或者,如果您更喜欢Nginx,则可以

如果您在MacOS上,则允许您安装最新版本的Apache和Nginx


或者,如果设置了Docker映像,您可以使用Docker映像,或者可以从源代码进行编译(对于MacOS来说相对简单,与linux非常相似,但对于Windows来说要复杂一点)。

最近,我使用NGINX在MAMP Pro上为NodeJS应用程序配置了HTTP2。我写了一篇关于它的短文,我想它会对你有所帮助。

我建议使用docker设置,而不是MAMP。有了docker,你会更加灵活。你解决了吗?我也想知道。