Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用Nginx作为反向代理登录不了 #1

Closed
jlcoding opened this issue Sep 19, 2019 · 3 comments
Closed

使用Nginx作为反向代理登录不了 #1

jlcoding opened this issue Sep 19, 2019 · 3 comments

Comments

@jlcoding
Copy link

使用Nginx作为反向代理登录不了, root登录成功会跳回到登录界面

@snail007
Copy link
Owner

我验证一下

@snail007
Copy link
Owner

我是用最新版nginx反向代理,可以正常登录和使用。nginx.conf如下:

`
#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;

map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}

upstream testproxy {
server 10.2.0.152:32080;
}

server {
server_name test.net;
listen 80;
# listen 443 ssl;
location / {
proxy_pass http://testproxy;
proxy_read_timeout 300s;
proxy_send_timeout 300s;

     proxy_set_header Host $host;
     proxy_set_header X-Real-IP $remote_addr;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
     
     proxy_http_version 1.1;
     proxy_set_header Upgrade $http_upgrade;
     proxy_set_header Connection $connection_upgrade;
 }
# ssl_certificate /etc/letsencrypt/live/test.enzhico.net/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/test.enzhico.net/privkey.pem;

}

# 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;
#    }
#}

}
`

@jlcoding
Copy link
Author

好的~ 我试一下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants