1. 程式人生 > >Ubuntu 14.04 安裝Nginx

Ubuntu 14.04 安裝Nginx

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