Ubuntu 14.04 安装 nginx

718 查看

切换到root,这个可以不用跟我一样,我主要是为了方便,但这不是个好习惯

sudo su

切换到用户主目录 iflytek是我的用户名,你们需要修改这个目录

cd /home/iflytek

下载nginx签名密钥
For Debian/Ubuntu, in order to authenticate the nginx repository signature and to eliminate warnings about missing PGP key during installation of the nginx package, it is necessary to add the key used to sign the nginx packages and repository to the apt program keyring.

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

lsb_release -c 可以查看系统的codename
我用的是Ubuntu 14.04 所以我的codename是trusty
添加nginx源

echo "deb http://nginx.org/packages/mainline/ubuntu/ trusty nginx" >> /etc/apt/sources.list
echo "deb-src http://nginx.org/packages/ubuntu/ trusty nginx" >> /etc/apt/sources.list

安装nginx

apt-get update
apt-get install nginx

切换root到iflytek

sudo su iflytek