用户名:jxzhfei 文章数:41 评论数:5
访问量:9547:858:442:3 注册日期:2010-03-23
nginx+memcached+tomcat集群 session共享完整版
集群环境
1.nginx版本 nginx-1.6.2.tar.gz
2.jdk 版本 jdk-7u21-linux-x64.tar.gz
3.tomcat 版本 7.0.29
4.memcached 版本 memcached-1.4.22.tar.gz
5. CentOS 6.5 系统采用一台服务做测试
一、nginx安装
安装依赖包 yum -y install gcc gcc-c++
1.安装pcre库
tar zxvf pcre-8.36.tar.gz
cd pcre-8.36
./configure
make && make install
2.安装zlib库
tar zxvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure
make && make install
3.安装openssl
wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz
tar zxvf openssl-1.0.1c.tar.gz
4.安装nginx 注意指定prce zlib openssl原码包位置
tar zxvf nginx-1.6.2.tar.gz
cd nginx-1.6.2
./configure --prefix=/usr/local/nginx \
--with-http_ssl_module \
--with-pcre=/root/pcre-8.36 \
--with-zlib=/root/zlib-1.2.8 \
--with-openssl=/root/openssl-1.0.1c
make && make install
5.安装成功后配置
vi /usr/local/nginx/conf/nginx.conf 修改配置文件
#user nobody;
worker_processes 2;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
worker_rlimit_nofile 65535;
events {
use epoll;
worker_connections 65535;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 150;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
#gzip on;
gzip on;
##cache##
client_max_body_size 10m;
client_body_buffer_size 1m;
proxy_connect_timeout 5;
proxy_read_timeout 60;
proxy_send_timeout 5;
proxy_buffer_size 64k;
proxy_buffers 4 128k;
proxy_busy_buffers_size 128k;
proxy_temp_file_write_size 1m;
proxy_temp_path /home/temp_dir;
proxy_cache_path /home/cache levels=1:2 keys_zone=cache_one:200m inactive=1d max_size=30g;
#
没有评论:
发表评论