install nginx

来源:互联网 发布:联通宽带用广电网络 编辑:程序博客网 时间:2024/06/15 10:25

nginx需要安装openssl、gzip(压缩)和pcre(重写rewrite)


1. install pcre

cd /home
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.34.tar.gztar xzf pcre-8.34.tar.gzcd pcre-8.34./configure --prefix=/usr/local/pcre-8.34makemake installcd ../

2. install gzip

wget http://zlib.net/zlib-1.2.8.tar.gztar xzf zlib-1.2.8.tar.gzcd pcre-8.34./configure --prefix=/usr/local/zlib-1.2.8makemake installcd ../


3. install openssl

<pre name="code" class="plain">
cd /usr/local/
wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz
tar -zxvf openssl-1.0.1c.tar.gz
./config --prefix=/usr/local/openssl-1.0.1c
make
make install
cd ../

4. install nginx

wget http://nginx.org/download/nginx-1.7.9.tar.gztar -zxvf nginx-1.7.9.tar.gzcd nginx-1.7.9./configure --prefix=/usr/local/nginx --with-pcre=/home/pcre-8.34 --with-zlib=/home/zlib-1.2.8 --with-http_ssl_module --with-openssl=/home/openssl-1.0.1cmakemake installcd ../


5. restart.sh

#!/bin/shselfpath=$(cd "$(dirname "$0")"; pwd)echo $selfpathecho stop nginxps aux | grep nginx | awk '{print $2}'kill -9 `ps aux | grep nginx | awk '{print $2}'`echo start nginx$selfpath/nginxps aux | grep nginx



0 0