源码安装nginx
#!/bin/bash #安装nginx依赖 apt-get update apt-get install -y make apt-get install -y gcc apt-get install -y g++ apt-get install -y libpcre3 libpcre3-dev apt-get install -y openssl libssl-dev apt-get install -y zlib1g zlib1g-dev #安装nginx cd /usr/local wget http://nginx.org/download/nginx-1.8.1.tar.gz #下载 tar zxvf nginx-1.8.1.tar.gz #解压 mkdir nginx cd nginx-1.8.1 ./configure make #编译安装 make install #配置文件 cd /usr/local/nginx/conf
vi nginx.conf
#启动nginx /usr/local/nginx/sbin/nginx #---安装http_gzip_static_module cd nginx-1.8.1 #安装目录 ./configure --with-http_gzip_static_module make #不要make install cp /usr/local/nginx-1.8.1/objs/nginx /usr/local/nginx/sbin/nginx #把新编译的nginx替换到旧的(这里可以先把原来的nginx执行脚本备份一下)