关于ngnix反向代理,导致系统在登录的时候无法登陆。大家知道是不是配置哪里有问题啊 求大声

追风筝的Coder 2016-12-28 06:05:49


#user nobody;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;


events {
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;
gzip on;#启用Gizp压缩

#服务器的集群
upstream netitcast.com { #服务器集群名字
server 127.0.0.1:18080 weight=1;#服务器配置 weight是权重的意思,权重越大,分配的概率越大。
server 127.0.0.1:28080 weight=1;
}


server {
listen 8080;
server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
index index.jsp
proxy_pass http://netitcast.com;
proxy_redirect off;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;

# location / {
# root html;
# index index.html index.htm;
# }
#}


# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;

# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;

# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;

# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;

# location / {
# root html;
# index index.html index.htm;
# }
#}

}



我这个代码里面我就添加了一个服务器集群,以及一个location。然后可以登录我的系统,系统可以由ngnix来自由分配。但是在登录页面的时候,发现就是实现登录成功。
如下图:





求大神指点 一下,看下是不是哪里配置漏了或者是我还需要做什么?无法系统登录也无法正常跳转到系统中,点击登录以后,页面刷新了一下,然后还是在原来的页面。

...全文
761 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
追风筝的Coder 2016-12-30
  • 打赏
  • 举报
回复
非常谢谢 确实是这个问题
孟子E章 2016-12-28
  • 打赏
  • 举报
回复
你使用的是Session保存的登录信息吧?每次请求去了不同的服务器,无法验证 如果不想改代码,可以nginx按ip分配服务器 upstream backserver { ip_hash; server 127.0.0.1:18080; server 127.0.0.1:28080; } 而不是按照权重

24,922

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Apache
社区管理员
  • Apache
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧