Nginx反向代理问题

问题描述:nginx配置反向代理后,登录接口出现无可用返回数据现象。

以下是5.232服务器上的nginx配置,后台接口部署在5.186上

worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
     server {
        listen       80;
        server_name  localhost;
        #access_log  logs/host.access.log  main;
        location / {
		    root D:/apocal_server/web;
            try_files $uri $uri/ @router;
            index  index.html index.htm;
			error_page 405 = $uri;
        }

		location /apocal {
			proxy_pass http://192.168.5.186:8081/apocal;
			proxy_cookie_path /apocal/ /;
			client_max_body_size 10000m;
			error_page 405 =200 /index.html;
		}		

        #对应上面的@router,主要原因是路由的路径资源并不是一个真实的路径,所以无法找到具体的文件
        #因此需要rewrite到index.html中,然后交给路由在处理请求资源
        location @router {
            

猜你喜欢

转载自blog.csdn.net/zsj777/article/details/121275913