ubuntu 18.04 安装最新版nginx

发布日期:
$ sudo wget https://nginx.org/keys/nginx_signing.key
$ sudo apt-key add nginx_signing.key

新建 /etc/apt/sources.list.d/nginx.list 文件,加入

deb https://nginx.org/packages/mainline/ubuntu/ bionic nginx
deb-src https://nginx.org/packages/mainline/ubuntu/ bionic nginx
$ sudo apt-get remove nginx-common
$ sudo apt-get update
$ sudo apt-get install nginx

装完之后默认的根目录在 /usr/share/nginx/html 修改重新修改配置文件

比较麻烦,没有需求的同学安装默认源里的nginx就好了