安装gcc编译器
sudo apt-get install gcc
安装盘pcre库,以支持正则
apt-get install libpcre++0
安装zlib,支持gzip压缩
apt-get install zlib1g-dev
安装打包程序
apt-get install make
wget http://nginx.org/download/nginx-1.0.8.tar.gz
tar xzvf nginx-1.0.8.tar.gz
cd nginx-1.0.8
./configure --prefix=/opt/nginx --conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log
make
sudo make
设置开机启动
wget http://www.cslog.cn/wp-content/uploads/2010/10/nginx.gz
gunzip nginx.gz
sudo mv nginx /etc/init.d
sudo chmod +x /etc/init.d/nginx
sudo update-rc.d -f nginx defaults