米狗

  • kubernets
  • docker
  • AWS
  • linux
  • nginx
Kratos
  1. 首页
  2. 中间件
  3. nginx
  4. 正文

企业nginx内网基础配置及目录跳转配置

2022年8月28日 572点热度 0人点赞 0条评论

nginx内网常规配置

   ## THE IP ADDRESS OF "bpsrms.demo.com.local" ##
    upstream bpsrms.demo.com.local {
        server 10.99.11.141:6060;
    }
    ## THE SERVER INFOMATION OF "bpsrms.demo.com.local" ##
    server
    {
        listen 80;
        server_name bpsrms.demo.com.local;
        access_log /usr/local/nginx/logs/bpsrms.demo.com.local.access.log main;
        location / {
            proxy_pass http://bpsrms.demo.com.local;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto  $scheme;
            client_max_body_size 100m;
            proxy_connect_timeout 75s;
            proxy_read_timeout 300s;
        }
        if ($request_method !~ ^(GET|HEAD|POST)$ ) {
            return 501;
        }
        proxy_intercept_errors on;
        error_page  500 502 503 504 /50x.html;
        error_page 404 /404.html;
        location  ~ /(404|50x).html {
            root html/errorHtml;
        }
        location ~ .*/errorHtml/ {
            rewrite ^/.*/(errorHtml/.*)$ /$1 permanent;
            access_log off;
        }
        location = /favicon.ico {
            log_not_found off;
            access_log off;
        }
        location = /robots.txt {
            log_not_found off;
        }
    }

nginx内网目录跳转配置

    ## THE IP ADDRESS OF "dataxweb.demo.com" ##
    upstream dataxweb.demo.com {
        server 10.99.11.140:8080;
        server 10.99.11.141:8080 backup;
    }

    ## THE SERVER INFOMATION OF "dataxweb.demo.com" ##
    ## HTTP REWRITE TO HTTPS
    server {  
        listen            80; 
        server_name        dataxweb.demo.com; 
        rewrite            ^(.*)$  https://$host/cbs/$1 permanent; 
    }
    ## SERVER INFO
    server {
        listen                                       443;
        server_name                                  dataxweb.demo.com;
        ssl                                          on;
        ssl_certificate                              aNoahwm(sha2).pem;
        ssl_certificate_key                          aNoahwm(sha2).key;
        ssl_session_timeout                          5m;
        ssl_protocols                                TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers                                  'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES';
        ssl_prefer_server_ciphers                    on;
        access_log                                   /usr/local/nginx/logs/dataxweb.demo.com.access.log main;
        location / {
            rewrite  ^(.*)$ https://$host/cbs/$1 permanent;
        }
        location ^~ /cbs/ {
            proxy_set_header SSL_CERT $ssl_client_cert;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto  $scheme;
            proxy_pass  http://dataxweb.demo.com/cbs/;
            client_max_body_size 100m;
            proxy_connect_timeout 75s;
            proxy_read_timeout 300s;
        }
        location ^~ /ueditor/ {
            proxy_set_header SSL_CERT $ssl_client_cert;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto  $scheme;
            proxy_pass  http://dataxweb.demo.com/ueditor/;
            client_max_body_size 100m;
            proxy_connect_timeout 75s;
            proxy_read_timeout 300s;
        }
        if ($request_method !~ ^(GET|HEAD|POST)$ ) {
            return 501;
        }
        proxy_intercept_errors on;
        error_page  500 502 503 504 /50x.html;
        error_page 404 /404.html;
        location  ~ /(404|50x).html {
            root html/errorHtml;
        }
        location ~ .*/errorHtml/ {
            rewrite ^/.*/(errorHtml/.*)$ /$1 permanent;
            access_log off;
        }
        location = /favicon.ico {
            log_not_found off;
            access_log off;
        }
        location = /robots.txt {
            log_not_found off;
            access_log off;
        }
    }
标签: 暂无
最后更新:2022年8月28日

duhongjun

这个人很懒,什么都没留下

点赞
< 上一篇
下一篇 >

归档

  • 2024 年 10 月
  • 2024 年 4 月
  • 2024 年 3 月
  • 2024 年 2 月
  • 2024 年 1 月
  • 2023 年 11 月
  • 2023 年 4 月
  • 2023 年 2 月
  • 2023 年 1 月
  • 2022 年 11 月
  • 2022 年 10 月
  • 2022 年 9 月
  • 2022 年 8 月
  • 2021 年 12 月
  • 2021 年 11 月
  • 2021 年 8 月
  • 2021 年 7 月
  • 2021 年 6 月
  • 2021 年 2 月
  • 2020 年 1 月
  • 2019 年 12 月
  • 2019 年 11 月
  • 2019 年 10 月
  • 2019 年 9 月
  • 2019 年 8 月

分类目录

  • AWS
  • docker
  • elasticsearch
  • Jenkins
  • kubernets
  • linux
  • mysql
  • nginx
  • Oracle
  • php
  • redis
  • zabbix
  • 个人
  • 中间件
  • 公有云
  • 大数据
  • 安全工具
  • 微软
  • 操作系统
  • 数据库
  • 未分类
  • 监控
  • 科技
  • 网络技术
  • 资讯
  • 阿里云

COPYRIGHT © 2024 米狗. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

沪ICP备2021019346号-1