nginx+tomcat实现负载均衡
来源:互联网 发布:淘宝卖家关闭交易 编辑:程序博客网 时间:2024/05/18 02:22
./configure
make && make install
cd ../
cd nginx-1.0.2/
./configure --user=root --group=root --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module 如果出错,先看看 4、安装zlib
make && make install
cd ../
chmod +w /home/nginx/logs
chown -R root:root /home/nginx/logs
rm -f /usr/local/nginx/conf/nginx.conf
vi /usr/local/nginx/conf/nginx.conf
vi /usr/local/nginx/conf/fcgi.conf
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
/usr/local/nginx/sbin/nginx
net.core.netdev_max_backlog = 32768
net.core.somaxconn = 32768
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 2
net.ipv4.tcp_tw_recycle = 1
#net.ipv4.tcp_tw_len = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_max_orphans = 3276800
#net.ipv4.tcp_fin_timeout = 30
#net.ipv4.tcp_keepalive_time = 120
net.ipv4.ip_local_port_range = 1024 65535
/usr/local/nginx/sbin/nginx -t
the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
the configuration file /usr/local/nginx/conf/nginx.conf was tested successfully
# This script run at 00:00
# The Nginx logs path
logs_root_path="/home/nginx/logs/"
logs_path=${logs_root_path}$(date -d "yesterday" +"%Y")/$(date -d "yesterday" +"%m")/
mkdir -p ${logs_path}
#日志文件名 ====================================================
logs_name="weblogs"
logs_file=${logs_root_path}${logs_name}.log
cut_logs_file=${logs_path}${logs_name}_$(date -d "yesterday" +"%Y%m%d").log
mv ${logs_file} ${cut_logs_file}
tar czf ${cut_logs_file}.tar.gz ${cut_logs_file}
rm -f ${cut_logs_file}
#重启nginx
/usr/local/nginx/sbin/nginx -s reload
对这个脚本赋执行权限
# chmod +x /usr/local/nginx/sbin/cut_nginx_log.sh
maxThreads="2048" minSpareThreads="100" maxSpareThreads="200"
enableLookups="false" redirectPort="8443" acceptCount="500"
connectionTimeout="20000" disableUploadTimeout="true" />
<Engine name="Catalina" defaultHost="localhost" jvmRoute="worker1">
新手在尝试安装nginx时,常常会因为缺少依赖组件,导致nginx相应模块无法安装,在执行“./configure”时常出现错误。
若在“./configure”后方加入了“--with-http_gzip_static_module”(添加gzip压缩模块)提示以下错误:
./configure: error: the HTTP gzip module requires the zlib library.You can either disable the module by using –without-http_gzip_moduleoption, or install the zlib library into the system, or build the zlib
librarystatically from the source with nginx by using –with-zlib=<path> option.
则需要安装“zlib-devel”即可。SSH执行以下命令:
yum install -y zlib-devel
ln -s libpcre.so.
0.0
.
1
libpcre.so.
1
- nginx tomcat实现负载均衡
- nginx+tomcat实现负载均衡
- Nginx+tomcat实现负载均衡
- nginx+tomcat实现负载均衡
- nginx+tomcat实现负载均衡
- Nginx+Tomcat实现负载均衡
- Nginx+Tomcat实现负载均衡
- nginx+tomcat 实现负载均衡
- Nginx+Tomcat 实现负载均衡
- Nginx+Tomcat实现负载均衡
- Nginx+Tomcat实现负载均衡
- nginx+tomcat实现负载均衡
- 负载均衡设计Nginx+Tomcat实现负载均衡(一)
- 负载均衡设计Nginx+Tomcat实现负载均衡(二)
- 负载均衡设计Nginx+Tomcat实现负载均衡(三)
- nginx + tomcat 集群实现负载均衡
- nginx + tomcat 集群实现负载均衡
- Nginx + Tomcat + Terracotta 实现负载均衡
- ZJU1003-Crashing Ballon
- apache kafka源代码工程环境搭建(IDEA)
- Velocity使用总结
- 树状数组(2)
- Python爬虫实战六之抓取爱问知识人问题并保存至数据库
- nginx+tomcat实现负载均衡
- 299. Bulls and Cows ——猜数字游戏
- Android Studio安装:Unable to access Android SDK add-on list
- nodejs 项目编译
- 类的继承 保护继承和私有继承
- iOS 根据 crash 崩溃 报告的内存地址定位到代码位置
- POJ 1700
- 使用eclipse创建java项目
- leetcode之ZigZag Conversion