简体   繁体   中英

HTTP2 support in MAMP Pro

Is there any way to enable HTTP2 support in MAMP Pro? I want to test and improve some of my local development websites with HTTP2 support.

I've been searching for a while now, but haven't found a single solution.

Recently I configured HTTP2 for NodeJS APP on MAMP Pro with NGINX. I wrote short article about it https://www.linkedin.com/pulse/nodejs-http2-server-mamp-pro-nginx-sergei-iastrebov/ I think it'll help you.

As Tarun has stated the versions of Apache and Nginx included in MAMP pro do not support HTTP/2. Additionally HTTP/2 requires a modern version of OpenSSL (1.0.2) to support HTTP/2 on most browsers.

Your best options are therefore to change Apache and/or Nginx to support this. You can then copy the appropriate config to connect up to the rest of the MAMP stack (eg MySQL, PHP..etc.).

If you are on Windows then ApacheHaus and Apache Lounge offer up to date Apache versions with HTTP/2 support. Or if you prefer Nginx then can download these directly from Nginx .

If you are on MacOS then Homebrew allows you to install up to date versions of Apache and Nginx.

Alternatively you can use a Docker image if set up for that, or can compile from source (relatively simple for MacOS as very similar as for linux, but a good bit more complicated for Windows).

If you are using Nginx you can just add following code into your server block or http block (for global) to the nginx.conf

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

Otherwise, if Apache you can do above, then open Nginx setting and enable "Use Nginx as a Reverse Proxy of Apache"

For MAMP Pro v4.0.0

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 is not built with HTTP2 support

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"

If you look at Apache HTTP2 module

Apache Module mod_http2

Available Languages: en

Description: Support for the HTTP/2 transport layer

Status: Extension

Module Identifier: http2_module

Source File: mod_http2.c

Compatibility: Available in version 2.4.17 and later

The minimum version of Apache is not met with MAMP Pro 4 using Apache 2.2.31 .

So you can't use the HTTP2 module. It is better off to use other newer version apache through docker or directly to work with HTTP2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM