Update, April 2018: Phoenix master supports Cowboy 2 now, so instead of using (the instructions from) this repository you can also do the following:
def deps do
{:phoenix, github: "phoenixframework/phoenix", override: true},
...
{:cowboy, "~> 2.3"}
end
An example application for using phoenix_cowboy2.
The diff for upgrading from cowboy to cowboy2 is available in this commit:
git clone git@gitgub.com:voicelayer/phoenix_cowboy2_example.git
cd phoenix_cowboy2_example
- An SSL certificate is required as most browsers only support HTTP/2 when using HTTPS
openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -keyout priv/server.key -out priv/server.pem
mix deps.get
npm install
mix phoenix.server
- Navigate to https://localhost:4001
If the application is successfully running under HTTP/2 then you should see:
Otherwise you should see:
If you navigate to the http version of the site you will see the message above.