Step 1: Under Linux or Mac, the installation of Nginx depends on the Pcre package, download it.
Step 2: Compile and install pcre
$ cd ~/Downloads/ $ tar -xzvf pcre-8.37.tar.gz $ cd pcre-8.37 $ ./configure --prefix=/usr/local/pcre $ sudo make $ sudo make install
Step 3: Find the download page on the Nginx official website and download it.
Step 4: Compile and install Nginx
$ cd ~/Downloads/ $ tar -xzvf nginx-1.9.3.tar.gz $ cd nginx-1.9.3 $ ./configure --prefix=/usr/local/nginx --with-pcre=/Users/huan/software/pcre-8.37 $ sudo make $ sudo make install
Note: Please pay attention to the command marked in red above, --with-pcre=<path> is followed by the source directory of pcre, not the installation directory. Otherwise, an error will be reported.