1.首先创建用户组
sudo groupadd www
2.创建用户
sudo useradd -g www www
3.安装nginx依赖包
sudo apt-get install libpcre3-dev zlibc zlib-bin libssl-dev
4.安装make
sudo apt-get install make
5.安装git
sudo apt-get install git
6.下载substitutions4nginx
git clone https://github.com/yaoweibin/ngx_http_substitutions_filter_module
7.下载nginx源码包
wget -c http://www.nginx.org/download/nginx-1.0.8.tar.gz
8.解压
tar zxvf nginx-1.0.8.tar.gz
(z用gzip对存档压缩或解压; x从存档展开文件; v详细显示处理的文件; f指定存档或设备)
9.编译安装
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --add-module=/home/zbs/ngx_http_substitutions_filter_module
sudo make
sudo make install
10.启动nginx
/usr/local/nginx/sbin/nginx
关闭命令:/usr/local/nginx/sbin/nginx -s stop (停止)
重启命令:/usr/local/nginx/sbin/nginx -s reload (重启)
启动出错
1.更改权限:sudo chmod a+rwx -R /usr/local/nginx/logs && sudo chmod a+rwx -R /usr/local/nginx
2.合理操作:sudo chown www:www /usr/local/nginx/logs
11.nginx依赖
http://www.2cto.com/os/201203/125517.html