Upgrade to Nginx mainstream 1.11.0 to solve a few http2 related problem

If you are using Nginx v1.10.0 and enabled http2 feature, there is a chance that your iOS app fails to connect to your server. Especially if you are using the AFNetworking library. The detail of the error NSURLErrorDomain Code=-1004 can be found here.

To overcome this problem, you have 3 options.

  1. Revert your Nginx version to v1.9.14 or before.
  2. Stay with the current version and disable the http2 feature.
  3. Upgrade to Nginx mainstream version v1.11.x and this is the recommended option.

How to upgrade?

By default, the stable version (currently v1.10.x) will be installed whenever you try to install with apt-get. In order to get the mainstream version, follow the steps below.

First, create a new source list file if it is not already available.

sudo pico /etc/apt/sources.list.d/nginx.list

Enter the following repositories into the file and save it. Replace $release with your ubuntu version, e.g. trusty or xenial.

deb http://nginx.org/packages/mainline/ubuntu/ $release nginx
deb-src http://nginx.org/packages/mainline/ubuntu/ $release nginx

Get and add the signing key

wget http://nginx.org/keys/nginx_signing.key
sudo apt-key add nginx_signing.key

Finally, you can install Nginx.

sudo apt-get update
sudo apt-get install nginx

AI Summary
Chrome On-device AI 2024-12-06 18:28:42

Share Article