Nginx:如何安装配置Ipv6网络

ubuntu18下升级nginx到最新版

Adding the repository
Fortunately, this doesn’t have to be installed from source, as there is an official NGINX repository where the latest version can be found. To add this repository, create a new .list file with the command:

vi /etc/apt/sources.list.d/nginx.list

In that file, paste the following two lines:

deb [arch=amd64] http://nginx.org/packages/mainline/ubuntu/ bionic nginx
deb-src http://nginx.org/packages/mainline/ubuntu/ bionic nginx

Save and close the file.
Before installation, the NGINX public key must be added. To do this, issue the following commands:

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

Update and install
Once you have the key installed, update apt with the command:

apt-get update

On the off-chance you already have an older version of NGINX installed, remove it (and it’s components) with the command:

apt remove nginx nginx-common nginx-full nginx-core

If you did have NGINX installed (and your website server blocks configured), you might want to make a backup of your configuration file with the command:

cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.old

Now it’s time to install the latest version of NGINX. Do so with the command:

apt-get install nginx -y

After the installation completes, start and enable NGINX with the commands:

systemctl start nginx
systemctl enable nginx

To find out which version of NGINX was installed, issue the command:

nginx -v

You should see that (at least as of this writing), the version number is 1.25 (Figure A), which is the latest version (as opposed to 1.14 installed from the standard repositories).