码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • Docker部署ruoyi前后端分离项目 补充


    1. 安装docker 请参考阿里网站 安装Docker并使用(Linux)
    2. 接下来请参考 Docker部署ruoyi前后端分离项目
    3. 后端项目补充说明:后端项目部署成功,包括mysql和redis
      前端项目部署补充说明:(稍微修改了下)
      创建两个文件夹存放前端项目和nginx配置文件
    mkdir -p /data/nginx/{conf,html}
    
    • 1
    进入/data/nginx/conf目录,配置nginx配置文件Default.conf
    
    • 1
    cd /data/nginx/conf
    
    • 1

    可以用vim打开这个文件

    vim Default.conf
    
    • 1

    Default.conf的内容:

    server {
        listen       80;
        server_name  localhost;
    
        
        location / {
            root   /usr/share/nginx/html/dist;
            index  index.html index.htm;
    	try_files $uri $uri/ /index.html;
        }
    
        location /prod-api/{
        	proxy_set_header Host $proxy_host;
    	proxy_set_header X-Real-IP $remote_addr;
    	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    	proxy_pass http://192.168.0.107:8081/;#192.168.0.107是ubuntu宿主机ip,8081是后端端口
        }
        #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;
        #}
    
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}
    
        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49

    运行

    docker run -itd --name zking-nginx --network net-ry -p 80:80 \
    -v /data/nginx/conf/Default.conf:/etc/nginx/nginx.d/Default.conf \
    -v /data/nginx/html:/usr/share/nginx/html \
    --privileged=true --restart=always \
    nginx
    
    • 1
    • 2
    • 3
    • 4
    • 5
  • 相关阅读:
    C语言的goto err
    SDN落地场景
    计算机竞赛 基于深度学习的人脸专注度检测计算系统 - opencv python cnn
    集合工具类的常用方法--小总和
    java中如何对List中的数据进行排序呢?
    高等数学(第七版)同济大学 习题10-2(前10题) 个人解答
    搭建本地人工智能框架LocalAI
    STM32 IIC 实验
    bp神经网络反向传播原理,BP神经网络反向传播
    智慧图书馆,RFID技术在图书借还,图书防盗中的应用优势
  • 原文地址:https://blog.csdn.net/qq_30908357/article/details/136617083
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号