Sometimes the nginx we install with apt-get in ubuntu and other servers is not up to date and is too cumbersome to compile.
We need to quickly install the latest version of Nginx, using the following method.
1. homebrew-nginx
On the MAC, you can use Homebrew, which installs your own modules, all of which homebrew provides.
Its address is: github.com/Homebrew/ho…
Installation method is as follows:
$ brew tap homebrew/nginx
$ brew install nginx-full
Copy the code
For specific methods of installing modules, just look at the above address.
2. linuxbrew
Under Linux, there is no real Homebrew, but someone has written a Linuxbrew copy of homebrew.
Its address is: github.com/Linuxbrew/b…
Install LinuxBrew first.
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install)"
$ echo 'export PATH="$HOME/.linuxbrew/bin:$PATH"' >>~/.bash_profile
Copy the code
Once installed, you can use the BREW command to install the desired software.
Install the latest version of Nginx as above.
3. Install the software from the software source
Its address is: nginx.org/en/linux_pa…
Find a distribution that works for you and install it.
If you are using Ubuntu 16.04 to install Nginx, you can use the following source:
# /etc/apt/sources.list
deb http://nginx.org/packages/mainline/ubuntu/ xenial nginx
deb-src http://nginx.org/packages/mainline/ubuntu/ xenial nginx
Copy the code
If it’s 14.04, replace xenial with Trusty.
And then:
wget http://nginx.org/keys/nginx_signing.key sudo apt-key add nginx_signing.key sudo apt-get update sudo apt-get install nginxCopy the code
4. nginx-build
The final method is to install nginx using nginx-build.
If you are running a MAC, you can install nginx-build first.
brew tap cubicdaiya/nginx-build
brew install nginx-build
Copy the code
nginx-build -d work
Copy the code
It builds a directory called Work with its source code, configuration, and so on.
After:
CD work/nginx/1.11.6/nginx-1.11.6 sudo make installCopy the code
It can be built with some parameters, such as specifying the version, specifying the third-party module, specifying the installation path, etc.
The end.