FelixLuoTing 2023-12-17 23:06 采纳率: 91.7%
浏览 51
已结题

部署的前端项目访问的时候空白页面

windows环境下的docker部署前端项目,部署上去了,但为什么访问的时候页面是空白的呢 是什么原因 有懂的吗

这是前端nginx的配置


```xml
gzip on; #开启或关闭gzip on off
gzip_disable "msie6";
gzip_buffers 4 16k;
gzip_comp_level 8;
gzip_types text/plain application/x-javascript application/javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;

server {
    listen       8080;
    server_name  10.240.12.21;
    #charset koi8-r;
    access_log  /var/log/nginx/host.access.log  main;
    error_log  /var/log/nginx/error.log  error;
    location / {
        add_header 'Access-Control-Allow-Headers' '*';
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
        add_header 'Access-Control-Allow-Origin' '*';
        root   /usr/share/nginx/html;
        index  index.html index.htm;
        try_files $uri $uri/ /index.html;
    }
    #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;
    }
}

然后是前端的dockerfile
FROM nginx:latest

COPY dist/  /usr/share/nginx/html/
COPY nginx/default.conf /etc/nginx/conf.d/default.conf


然后运行的结果

![img](https://img-mid.csdnimg.cn/release/static/image/mid/ask/6afda4c6255045738ec637c366e47a81.png "#left")
  • 写回答

1条回答 默认 最新

  • FelixLuoTing 2023-12-17 23:07
    关注

    img


    本人使用的是阿里云存储桶存储图片 是不是这个原因导致这个网页是空白的?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论 编辑记录

报告相同问题?

问题事件

  • 系统已结题 12月26日
  • 已采纳回答 12月18日
  • 创建了问题 12月17日