安装配置Nginx
1.预备安装包
1
apt-get install libpcre3 libpcre3-dev openssl libssl-dev libperl-dev
2.清理残余的旧版本
1
apt-get remove nginx nginx-common nginx-full
3.安装nginx PGP签名文件
1
2
wget http://nginx.org/keys/nginx_signing.key
sudo apt-key add nginx_signing.key
4.使用sudo修改source源
codename参数根据os来选择,比如我的OS是Debian 8 jessie,codename参数即为jessie
1
2
3
4
5
vi /etc/apt/sources.list
#在文件末追加以下,codename用os代号代替
#Debian7.0 -> wheezy, 8.0 -> jessie, 9.0 -> stretch
deb http://nginx.org/packages/mainline/debian/ jessie nginx
deb-src http://nginx.org/packages/mainline/debian/ jessie nginx
5.更新软件源并安装nginx
1
2
apt-get update
apt-get install nginx
6.查看nginx版本号
1
nginx -v
7.nginx启动
1
2
3
4
service nginx start
service nginx restart
service nginx reload
service nginx stop
8.登陆网页检查
登陆服务器IP或绑定的域名,看到熟悉的Nginx页面,安装成功。