配置好,启动后tomcat请求能够分发到不同端口的登录界面,但是填好账号和密码后,点击提交就请求不到了!
nginx.cof/劳烦大家给点帮助....thx
worker_processes 2;
error_log logs/error.log;
pid logs/nginx.pid;
events {
use epoll;
worker_connections 1024;
}
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 65;
gzip on;
upstream tomcat_server {
server 192.168.0.185:8091 weight=5;
server 192.168.0.185:8092 weight=5;
server 192.168.0.185:8093 weight=5;
}
server {
listen 81;
server_name localhost;
charset utf-8;
access_log logs/host.access.log main;
location / {
proxy_pass http://tomcat_server;
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 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
回答:我总结了一个系列关于nignx的文章,待你学习一下之后,其实nginx很简单,那么你这个问题就不解自破!
Nginx系列教程(4)nginx处理web应用负载均衡问题以保证高并发
Nginx系列教程(5)如何保障nginx的高可用性(keepalived)
Nginx系列教程(6)nginx location 匹配规则详细解说
tomcat应该是有session的,并且你tomcat之间没有共享session。可以让nginx做绑定后端分发试试,或者解决掉tomcat的session共享问题:
upstream myapp1 {
ip_hash;
server srv1.example.com;
server srv2.example.com;
server srv3.example.com;
}
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。