nginx静态文件双节点,静态文件发送post请求报405

nginx静态文件双节点

思想

nginx跳转到另一个nginx

两台服务器113和112都装有nginx,113为入口,分别配置113和112双节点静态文件

113nginx

server {
        listen       80;
        server_name  xxxx;

        access_log  logs/zeq.access.log  main;
        error_log   logs/zeq.error.log  error;
		#nginx配置静态文件,发送post请求会报405,将405捕获
        error_page  405 =200 @405;
        location @405 {
                proxy_method POST;
                proxy_pass http://gateway;
        }

        location / {
                #alias /etc/nginx/admin/;
                #index index.html index.htm;
                #解决angular容器导致的异常
                #try_files $uri $uri/ /index.html =404;
                proxy_pass http://admin;
        }
}
server {
        listen       4201;
        server_name  172.18.0.113;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            alias /usr/local/nginx/admin/;
            index index.html index.htm;
            try_files $uri $uri/ /index.html =404;
        }
        error_page  405 =200 @405;
        location @405 {
                proxy_method POST;
                proxy_pass http://gateway;
        }
    }
upstream admin {
   server 172.18.0.113:4201;
   server 172.18.0.112:4201;
}

112nginx

server {
        listen       4201;
        server_name  172.18.0.112;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            alias /usr/local/nginx/admin/;
            index index.html index.htm;
            try_files $uri $uri/ /index.html =404;
        }
        error_page  405 =200 @405;
        location @405 {
                proxy_method POST;
                proxy_pass http://gateway;
        }
    }

upstream gatewayt {
   server 172.18.0.119:8070;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值