加入nginx的repository
$ cd /home/
$ wget http://nginx.org/keys/nginx_signing.key
$ sudo apt-key add nginx_signing.key
$ cd /etc/apt/sources.list.d/
$ sudo vim nginx.list
将下面2行复制粘贴到这个文件
deb http://nginx.org/packages/ubuntu/ lucid nginx
deb-src http://nginx.org/packages/ubuntu/ lucid nginx
2.用apt安装
$ sudo apt-get update
$ sudo apt-get install nginx
3.配置文件位置
/etc/nginx/nginx.conf
这个配置文件会包含/etc/nginx/conf.d/*.conf
默认主目录:/usr/share/nginx/html/
4.管理nginx服务
启动:$ sudo service nginx start
停止:$ sudo service nginx stop
重启:$ sudo service nginx restart