zoukankan      html  css  js  c++  java
  • Nginx中配置undertow进行两个项目的动静分离配置

    #user  nobody;
    worker_processes  4;
    
    pid         /var/run/nginx.pid;
    
    events {
        worker_connections  1024;
    }
    
    
    http {
        include       mime.types;
    
        # 加载naxsi
        include       naxsi_core.rules;
    
    
        default_type text/html;
    
        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;
    
        keepalive_timeout  65;
    
        gzip  on;
    
        upstream baseserver
        {
          server 127.0.0.1:9000;
        }
    
        upstream ssoserver
        {
          server 127.0.0.1:9001;
        }
    
    
        server {
            listen       80;
            listen       8018;
            #listen      443 ssl http2;
            server_name  localhost;
            # 黄海添加于2018-10-24
            #ssl on;
            #ssl_certificate /usr/local/openresty/nginx/conf/cacert.pem;
            #ssl_certificate_key /usr/local/openresty/nginx/conf/rsa_private_key.pem;
            #ssl_session_timeout  5m;
            #让http请求重定向到https请求
            #error_page 497  https://$host$uri?$args;
    
            location =/ {
                    proxy_set_header Host $host:$server_port;
                    proxy_set_header X-Real-IP $remote_addr;
                    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                    proxy_pass http://baseserver/baseService/;
                    proxy_redirect http://$host/ http://$http_host/;
            }
    
            location /baseService/html/ {
                    root /usr/local/tomcat8/webapps;
                    expires 30d;
            }
    
            location /dsssoserver/html/ {
                    root /usr/local/tomcat8/webapps;
                    expires 30d;
            }
    
    
            location ^~ /baseService {
                    proxy_set_header Host $host:$server_port;
                    proxy_set_header X-Real-IP $remote_addr;
                    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                    proxy_pass http://baseserver;
            }
    
            location ^~ /dsssoserver {
                    proxy_set_header Host $host:$server_port;
                    proxy_set_header X-Real-IP $remote_addr;
                    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                    proxy_pass http://ssoserver;
            }
    
    
    
    
            # 配置403
            location /errPage {
                #root /usr/local/openresty/nginx/html;
                rewrite ^/(.*)$ https://$host/403/403.html permanent;
            }
    
            location ^~/403/ {
                root /usr/local/openresty/nginx/html;
            }
    
    
    
            # redirect server error pages to the static page /50x.html
            #
            error_page   500 502 503 504  /50x.html;
            location = /50x.html {
                root   html;
            }
    
        }
    }
  • 相关阅读:
    LYDSY模拟赛day3 序列
    LYDSY模拟赛day3 涂色游戏
    LYDSY模拟赛day3 平均数
    hdu1757 A Simple Math Problem
    清北国庆day1 (脑)残
    poj3070 Fibonacci
    uva10870 递推关系Recurrences
    湖南附中模拟day1 瞭望塔
    湖南附中模拟day1 收银员
    湖南附中模拟day1 金坷垃
  • 原文地址:https://www.cnblogs.com/littlehb/p/10498307.html
Copyright © 2011-2022 走看看