• 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
  • 相关阅读:
    三种win10任务栏频繁卡死的解决方法
    「数据结构详解·五」链表
    centos启动停留在started GNOME display manager
    sql语句查询某字段中有汉字的数据
    归并排序的简单理解
    一本通1061;求整数的和与均值
    DeFi的历程与未来:探寻去中心化金融的前行路
    AI for Science:科研范式、开源平台和产业形态
    桌面云组件介绍与安装
    python创建分类器小结
  • 原文地址:https://blog.csdn.net/qq_30908357/article/details/136617083