当前位置: 首页 > article >正文

Docker项目部署-部署前端

nginx.conf文件内容如下。


worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/json;

    sendfile        on;
    
    keepalive_timeout  65;

    server {
        listen       18080;
        # 指定前端项目所在的位置
        location / {
            root /usr/share/nginx/html/hmall-portal;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
        location /api {
            rewrite /api/(.*)  /$1 break;
            proxy_pass http://hm:8080;
        }
    }
    server {
        listen       18081;
        # 指定前端项目所在的位置
        location / {
            root /usr/share/nginx/html/hmall-admin;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
        location /api {
            rewrite /api/(.*)  /$1 break;
            proxy_pass http://hm:8080;
        }
    }
}

 

部署成功,确保MySQL、nginx、Java应用在同一个网络。


http://www.kler.cn/a/569054.html

相关文章:

  • 一个基于C# Winform开源免费的通用快速开发框架,内置完整的权限架构!
  • 晶圆搬运真空机械臂概述
  • 【Elasticsearch】节点设置(Node Settings)是用于定义和管理集群中每个节点的行为和角色的关键配置
  • UE5切换关卡函数OpenLevel,输入模式结构体,UI界面
  • Vue.js 测试 Vue 3 Composition API
  • SQL Server 数据库管理工具的安装以及使用
  • C++数据结构之数组(详解)
  • SpringMVC学习(初识与复习Web程序的工作流程)(1)
  • 浅谈Linux中的软件包管理器——基于ubuntu环境
  • C++二分图
  • 鸿蒙(OpenHarmony/HarmonyOS)开发中常用的命令行工具及操作大全
  • 基于大数据的民宿旅馆消费数据分析系统
  • 0.2S级高精度物联网电能表技术参数介绍
  • 【每日学点HarmonyOS Next知识】全局调整字体、h5选择框无法取消选中、margin不生效、Length转换为具体值、Prop和link比较
  • react脚手架配置别名
  • [数据结构] - - - 链表
  • SpringBoot 端口配置
  • DeepSeek、Grok与ChatGPT:AI三巨头的技术博弈与场景革命
  • 存储对象(MySQL笔记第五期)
  • 【PromptCoder】使用 package.json 生成 cursorrules