Ubuntu14.04默认安装的是Nginx 1.4.6
如果已经安装,请先卸载
sudo apt-get remove nginx
安装方法:
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:nginx/stable
sudo apt-get update
sudo apt-get install nginx
查看nginx 版本
nginx -v
nginx version: nginx/1.12.0
注意的是,这种方法安装的nginx的配置文件和运行文件是分开的.
配置文件:/etc/nginx/nginx.conf
运行文件:/etc/init.d/nginx
要运行nginx要用以下命令开启:
/etc/init.d/nginx restart