# Setup nginx with HTTP/2 for local development (OS X)

DevFeed: [Setup nginx with HTTP/2 for local development (OS X)](<https://devfeed.tech/articles/setup-nginx-with-http-2-for-local-development-os-x-31998.md>)

Original publisher: [Read original article](<https://tech.finn.no2015/09/25/setup-nginx-with-http2-for-local-development/>)

Author: Gregers Rygg

Published: 2015-09-25T21:57:00Z

Content type: tutorial

Language: en

Sources: [Finn.no](<https://devfeed.tech/sources/finn-no.md>)

Topics: [nginx](<https://devfeed.tech/topics/nginx.md>), [Development](<https://devfeed.tech/topics/development.md>), [HTTP](<https://devfeed.tech/topics/http.md>), [Homebrew](<https://devfeed.tech/topics/homebrew.md>), [proxy](<https://devfeed.tech/topics/proxy.md>), [TLS (Transport Layer Security)](<https://devfeed.tech/topics/tls.md>), [browser](<https://devfeed.tech/topics/browser.md>)

Tags: [browser](<https://devfeed.tech/tags/browser.md>), [development](<https://devfeed.tech/tags/development.md>), [homebrew](<https://devfeed.tech/tags/homebrew.md>), [http](<https://devfeed.tech/tags/http.md>), [nginx](<https://devfeed.tech/tags/nginx.md>), [proxy](<https://devfeed.tech/tags/proxy.md>), [setup](<https://devfeed.tech/tags/setup.md>), [tls](<https://devfeed.tech/tags/tls.md>)

## AI overview

A practical guide to setting up nginx with HTTP/2 for local development on OS X. It explains using nginx as a secure HTTP/2 proxy in front of a local HTTP/1.1 server, with TLS 1.2 and Homebrew-based installation steps.

## Source excerpt

HTTP/2 became an official standard in May earlier this year, and support is starting to land in servers already. The most recent, and very welcome addition, is nginx 1.9.5 [1]. What makes nginx extra awesome is that it's very easy to set up in front of any other HTTP 1.x server (or HTTP/2 for that matter). Server push won't work just yet, but at least we can start to test how multiplexing works. Multiplexing is said to eliminate the need to concatenate resources into bundles. At FINN.no we do multiple releases a day, and it just feels wrong that users have to download the whole 100+ kB JavaScript bundle after every release, even though most of the time only a few lines have changed. If we don't need to bundle anymore, the users only need to download the few scripts that had changed since their last visit! HTTPS over TLS 1.2 is a requirement to use HTTP/2. Service Workers also require secure connections, and probably other features soon. This guide will help you set up nginx for local development on OS X, with proxy passing requests to your local server on port 8080 (or whichever port you prefer). In plain English, that means we put nginx in between your browser and your local development server. Your browser communicates securely over HTTP/2 to nginx, and nginx forwards the requests to your local server over unsecured HTTP/1.1. Installing nginx You have to compile nginx with the --with-http_v2_module configuration parameter, but Homebrew makes that a breeze. It's one of my favorite tools on OS X. If you don't have Homebrew, see Install Homebrew further down. To compile and install nginx with http2: $ brew update # update list of packages $ brew install --with-http2 nginx Test that the install works (make sure port 8080 is available): $ sudo nginx $ open http://localhost:8080/ You should see a page with the title "Welcome to nginx!" # stop nginx $ sudo nginx -s stop Now it's time to set up the https server with HTTP/2 enabled. Open /usr/local/etc/nginx/nginx.conf in