标签:openssl bin figure type 源代码 .com write log source
Nginx ("engine x") 是一个高性能的HTTP和反向代理服务器,以下为Linux centos平台下安装nginx并配置反向代理的过程(采用源码安装的方式)
1yum install gcc gcc-c++ 2 yum -y install gcc automake autoconf libtool make
cd /usr/local/src wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz tar -zxvf pcre-8.34.tar.gzcd pcre-8.34 ./configure make make install
cd /usr/local/src wget http://zlib.net/zlib-1.2.8.tar.gz tar -zxvf zlib-1.2.8.tar.gzcd zlib-1.2.8 ./configure make make install
wget http://www.openssl.org/source/openssl-1.0.1t.tar.gz tar -zxvf openssl-1.0.1t.tar.gz ./config shared --prefix=/usr/local --openssldir=/usr/local/ssl make depend make sudo make install
cd /usr/local/src wget http://nginx.org/download/nginx-1.10.1.tar.gz tar -zxvf nginx-1.10.1.tar.gz cd nginx-1.10.1 ./configure --sbin-path=/usr/local/nginx/sbin --conf-path=/usr/local/nginx/conf/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.39 --with-zlib=/usr/local/src/zlib-1.2.8 --with-openssl=/usr/local/src/openssl-1.0.1t make make install sudo make install
注:sbin-path(启动文件路径)
conf-path(配置文件路径)
pid-path(pid文件,刚安装完默认没有,只有启动nginx后才有)
Cd /usr/local/nginx/sbin
1.启动 ./nginx
2.重启 ./nginx -s reload
Cd /usr/local/nginx/conf
Vim nginx.conf
其中server选项配置如下
lerver{ listen 80; charset utf-8; location / { proxy_pass http://127.0.0.1:3000; } }
lerver{
listen 80;
charset utf-8;
location / {
proxy_pass http://127.0.0.1:3000;
}
}
http选项下
http选项下 gzip on; gzip_min_length 1k; gzip_buffers 16 64k; gzip_http_version 1.1; gzip_comp_level 6; gzip_types application/javascript text/javascript text/plain application/x-javascript text/css application/xml; gzip_vary on; 注意:gzip_types必须加上application/javascript 否则js不会被压缩
标签:openssl bin figure type 源代码 .com write log source
原文地址:http://www.cnblogs.com/ytu2010dt/p/6016892.html