标签:
显示nginx的核心配置
#user nobody;
worker_processes 1;
events {
worker_connections 1024; #并发连接数
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on; (1)下面是与tomcat集群配置的关键 配置了2个tomcat,分别工作在端口17080和18080
upstream localhost {
server 127.0.0.1:17080; #还可以配置各自的分发权重 weight=1
server 127.0.0.1:18080;
#ip_hash; #表示以hash的方式选择tomat节点
}
server {
listen 18900; #nginx的监听端口
server_name localhost; # (2)server_name必须和upstream后面的标识符一致
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
proxy_pass http://localhost; #(3)启用反向代理
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 100;
proxy_send_timeout 100;
proxy_read_timeout 100;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
配置tomcat的要点:
修改server.xml中
(1)<Server port="18005" shutdown="SHUTDOWN">
(2)<Connector port="18080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
(3)
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8109" protocol="AJP/1.3" redirectPort="8443" />
标签:
原文地址:http://www.cnblogs.com/zlfoak/p/4709743.html