nginx 同域名不同后缀连接不同后端app

简介:
upstream uat_appnew {
  server 192.168.248.4:8081;
}

upstream uat_app {
  server 192.168.248.4:8080;
}

server {
    listen       80;
    server_name  www.zzh.com;
    charset     gbk;
    access_log  /var/log/nginx/host.access.log  main;
    rewrite ^(.*) https://servernamerequest_uri permanent;
}

server {
    listen      443;
    server_name  www.zzh.com;
    charset     gbk;
    access_log  /var/log/nginx/host.access.log  main;
    add_header X-Frame-Options "SAMEORIGIN";
    location / {
        rewrite ^/https://server_name/estore/ permanent;
        #root   /usr/share/nginx/html;
        #index  index.html index.htm;
        proxy_max_temp_file_size         0k;
        #proxy_http_version 1.1;
        proxy_set_header Host            $host;
        proxy_set_header X-Real-IP       $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       #proxy_set_header X-Frame-Options SAMEORIGIN;
       #proxy_set_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
        add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";  
        add_header X-Frame-Options "SAMEORIGIN";
        proxy_pass http://uat_app;
    }

     location ~ /estoreNew {
        #rewrite ^/https://server_name/estoreNew/ permanent;
        #root   /usr/share/nginx/html;
        #index  index.html index.htm;
        proxy_max_temp_file_size         0k;
        #proxy_http_version 1.1;
        proxy_set_header Host            $host;
        proxy_set_header X-Real-IP       $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       #proxy_set_header X-Frame-Options SAMEORIGIN;
       #proxy_set_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
        add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";  
        add_header X-Frame-Options "SAMEORIGIN";
        proxy_pass http://uat_appnew;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}

}





本文转自 freeterman 51CTO博客,原文链接:http://blog.51cto.com/myunix/1834926,如需转载请自行联系原作者

目录
打赏
0
0
0
0
265
分享
相关文章
【01】对APP进行语言包功能开发-APP自动识别地区ip后分配对应的语言功能复杂吗?-成熟app项目语言包功能定制开发-前端以uniapp-基于vue.js后端以laravel基于php为例项目实战-优雅草卓伊凡
【01】对APP进行语言包功能开发-APP自动识别地区ip后分配对应的语言功能复杂吗?-成熟app项目语言包功能定制开发-前端以uniapp-基于vue.js后端以laravel基于php为例项目实战-优雅草卓伊凡
139 72
【01】对APP进行语言包功能开发-APP自动识别地区ip后分配对应的语言功能复杂吗?-成熟app项目语言包功能定制开发-前端以uniapp-基于vue.js后端以laravel基于php为例项目实战-优雅草卓伊凡
【Azure App Service】App Service 如何配置私网域名以及证书呢?
本文解答了关于 Azure App Service 如何配置私网域名及证书的问题。App Service 不支持私网域名,自定义域名需配置在公共 DNS 服务器上。文章引用官方文档详细说明了映射自定义 DNS 的步骤,并附带参考资料链接,帮助用户深入了解相关配置方法。
基于STM32的智能手环wifi连接手机APP(下)
基于STM32的智能手环wifi连接手机APP(下)
278 0
婚恋交友系统平台 相亲交友平台系统 婚恋交友系统APP 婚恋系统源码 婚恋交友平台开发流程 婚恋交友系统架构设计 婚恋交友系统前端/后端开发 婚恋交友系统匹配推荐算法优化
婚恋交友系统平台通过线上互动帮助单身男女找到合适伴侣,提供用户注册、个人资料填写、匹配推荐、实时聊天、社区互动等功能。开发流程包括需求分析、技术选型、系统架构设计、功能实现、测试优化和上线运维。匹配推荐算法优化是核心,通过用户行为数据分析和机器学习提高匹配准确性。
352 3
基于STM32的智能手环wifi连接手机APP(上)
基于STM32的智能手环wifi连接手机APP(上)
266 0
|
7月前
【Azure Logic App】使用Event Hub 连接器配置 Active Directory OAuth 认证无法成功连接到中国区Event Hub的解决之法
An exception occurred while retrieving properties for Event Hub: logicapp. Error Message: 'ClientSecretCredential authentication failed: AADSTS90002: Tenant 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' not found. Check to make sure you have the correct tenant ID and are signing into the correct cloud. Che
Nginx入门 -- 理解Nginx基础概念:连接(Connection)
Nginx入门 -- 理解Nginx基础概念:连接(Connection)
167 0
【Azure API 管理】APIM不能连接到 App Service (APIM cannot connect to APP service)
【Azure API 管理】APIM不能连接到 App Service (APIM cannot connect to APP service)
Django后端架构开发:Nginx服务优化实践
Django后端架构开发:Nginx服务优化实践
151 2
谁说后端不需要懂的-Nginx知识点
先赞后看,南哥助你Java进阶一大半他叫,一个俄罗斯程序员。就是他,着手开发了大名鼎鼎处理高并发、高负载网络请求的Nginx,同时他在2004年把Nginx作为开源软件发布。大家好,我是南哥。一个Java学习与进阶的领路人,相信对你通关面试、拿下Offer进入心心念念的公司有所帮助。
谁说后端不需要懂的-Nginx知识点

热门文章

最新文章

AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等