为了账号安全,请及时绑定邮箱和手机立即绑定

手把手从0打造电商平台-前端开发 静态资源404

手把手从0打造电商平台-前端开发 静态资源404

zjxjwxk 2018-12-09 00:33:16
有没有买了这个电商前端课程的小伙伴? 我学了这个课程的后端,然后打算把前端代码直接拿来用,在部署服务器的时候出现了问题,在npm run dist之后,把dist目录放在服务器的/product/mall_frontend/mmall/下,然后配置nginx如下(zjxjwxk.com是我的域名,我用了https):mall.zjxjwk.com.confserver {         listen 443 ssl;         autoindex on;         server_name mall.zjxjwxk.com;         access_log /usr/local/nginx/logs/access.log combined;         index index.html index.htm index.jsp index.php;         ssl_certificate /root/.acme.sh/zjxjwxk.com/fullchain.cer;         ssl_certificate_key /root/.acme.sh/zjxjwxk.com/zjxjwxk.com.key;         ssl_trusted_certificate /root/.acme.sh/zjxjwxk.com/ca.cer;         if ( $query_string ~* ".*[\;'\<\>].*" ){                 return 404;         }         location = / {                 root /product/mall_frontend/mmall/dist/view;                 index index.html;         }         location ~ .*\.html$ {                 root /product/mall_frontend/mmall/dist/view;                 index index.html;         }         location / {                 proxy_pass http://127.0.0.1:8080/;                 add_header Access-Control-Allow-Origin *;         }         location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {                 proxy_pass http://127.0.0.1:8080;                 expires 30d;         }         location ~ .*\.(js|css)?$ {                 proxy_pass http://127.0.0.1:8080;                 expires 7d;         } }然后我访问我的网页的时候是访问不到css,js这些静态资源的这里报错显示访问的资源在https://mall.zjxjwxk.com/dist/ 下面,这好像不太对。因为资源并没有在根目录下,而是在/product/mall_frontend/mmall/dist/下面。而看网页源码的时候,css访问的是/dist/css/下的文件本人对前端了解不多,但想完整构建一个电商项目,前端源码完全没有动过,求各位大佬指点有可能在哪出了错。
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 1621 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信