zoukankan      html  css  js  c++  java
  • nginx 配置 tomcat 多服务请求拦截

    #tomcat配置
    worker_processes  1;
    
    events {
        worker_connections  1024;
    }
    
    http {
        include       mime.types;
        default_type  application/octet-stream;
    
        sendfile        on;
        keepalive_timeout  65;
    
        #前端页面服务器
        server {
            #监听端口和域名
            listen       80; #nginx 端口
            server_name  localhost;
            
            
            #添加拦截路径和根目录
            #root   "C:/Users/Admin/Desktop/A/src/main/webapp/"; 
            
    
            #添加拦截路径和代理地址
            location / { #根目录
                root /root;
                proxy_pass http://localhost:8080/; #tomcat端口以及地址
                
            }    
            
            #添加拦截路径和代理地址 后端代码端口以及   context-path: /api
            location /api/ { #请求拦截到的URL
                proxy_pass http://localhost:8090/api/;
                proxy_set_header Host $http_host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header REMOTE-HOST $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                index  index.html index.htm; 
                
            }
    
        }
    }
  • 相关阅读:
    【Rust】变量绑定
    【Rust】枚举的使用
    1月25日 学习记录
    1月19日 学习记录
    1月22日 学习记录
    1月21日 学习记录
    1月29日 体温APP开发记录
    今日进度
    今日进度
    今日进度
  • 原文地址:https://www.cnblogs.com/luckgood/p/15186499.html
Copyright © 2011-2022 走看看