简体   繁体   English

Nodejs表达静态文件夹不适用于某些文件

[英]Nodejs express static folder doesn't works for some files

Hello guys I have a project written in NodeJs, express and AngularJS. 大家好我有一个用NodeJs,express和AngularJS编写的项目。 the problem I'm facing that my page doesn't find some js and css files in the public static folder and gives 404 error. 我面临的问题是我的页面在公共静态文件夹中找不到某些js和css文件,并给出404错误。 however, it works for the second half of the files! 但是,它适用于文件的后半部分! it's wired it know! 知道它有线! that why I'm asking after investigating for long time. 这就是为什么我经过长时间的调查后会问。

I face this bug only with the online server. 我只在线服务器面对这个bug。 ( it work perfectly for all links in my own computer) (它适用于我自己计算机中的所有链接)

the website is: http://alfa-srv.geo2.pl/ then login: admin@geo2.pl password: a 该网站是: http ://alfa-srv.geo2.pl/然后登录:admin@geo2.pl密码:a

then check the source code of the page you gonna find out that some files works and others doesn't for example: /css/style.css ====>> working /css/isteven-multi-select.css >> NOT working! 然后检查页面的源代码,你会发现某些文件有效,而其他文件没有例如:/css/style.css ==== >> working /css/isteven-multi-select.css >> NOT工作!

Also it looks like the server redirecting to /home page in case of those none found files! 此外,它看起来像服务器重定向到/ home页面,如果没有找到这些文件! to understand what I mean try to open manually http://alfa-srv.geo2.pl/css/isteven-multi-select.css 理解我的意思尝试手动打开http://alfa-srv.geo2.pl/css/isteven-multi-select.css

ls of css folder: ls的css文件夹:

ls -na public/css/ ls -na public / css /
total 1020 总共1020
drwxr-xr-x 2 0 0 4096 Oct 12 17:43 . drwxr-xr-x 2 0 0 4096 10月12日17:43。
drwxr-xr-x 5 0 0 4096 Oct 13 18:06 .. drwxr-xr-x 5 0 0 4096 10月13日18:06 ..
-rw-r--r-- 1 0 0 443882 Sep 5 17:02 angular-material.min.css -rw-r - r-- 1 0 0 443882 Sep 5 17:02 angular-material.min.css
-rwxr-xr-x 1 0 0 122848 Oct 12 17:43 bootstrap.css -rwxr-xr-x 1 0 0 122848 10月12日17:43 bootstrap.css
-rw-r--r-- 1 0 0 99548 Oct 12 17:43 bootstrap.min.css -rw-r - r-- 1 0 0 99548 10月12日17:43 bootstrap.min.css
-rw-r--r-- 1 0 0 7267 Oct 12 17:43 isteven-multi-select.css -rw-r - r-- 1 0 0 7267 10月12日17:43 isteven-multi-select.css
-rw-r--r-- 1 0 0 354734 Sep 5 17:02 style.css -rw-r - r-- 1 0 0 354734 Sep 5 17:02 style.css

Any suggestion? 有什么建议吗?

Check the files permissions. 检查文件权限。 maybe node does not have the rights to serve these files 也许节点没有权利提供这些文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM