JavaScript 文件的文件权限
File permissions for a JavaScript file
我的目录结构如下:
var/www/example.com/public_html/index.html
var/www/example.com/public_html/images/example.jpg
var/www/example.com/public_html/javascript/example.js
我运行以下文件和目录权限命令:
chmod -R 755 var/www/example.com/public_html
因此,以上所有文件都具有 755
权限,即 -rwxr-xr-x
(我已经通过 FileZilla 确认了这一点)。
我可以从我的浏览器导航到 index.html
和 example.jpg
。但是,当我导航到 example.js
时,出现 404 错误)。
我发现这一点的方式是我的 index.html
没有执行 javascript。所以index.html
也看不到example.js
。
可能是什么原因造成的?
更新:在本地主机上,index.html 可以正常执行 javascript 文件。这一切都发生在远程服务器上。
[已解决] -- 在按照下面的评论进行操作后, 它仍然无效。我认为服务器由于某种原因没有正确更新/刷新。所以我随后将 javascript 文件夹的名称更改为 js,并相应地更新了 index.html,然后奇迹般地一切正常。
关注此评论后: 仍然无效。我认为服务器由于某种原因没有正确更新/刷新。所以我随后将 javascript 文件夹的名称更改为 js,并相应地更新了 index.html,然后奇迹般地一切正常。
(当 Whosebug 允许时,我会将其标记为正确答案。)
我的目录结构如下:
var/www/example.com/public_html/index.html var/www/example.com/public_html/images/example.jpg var/www/example.com/public_html/javascript/example.js
我运行以下文件和目录权限命令:
chmod -R 755 var/www/example.com/public_html
因此,以上所有文件都具有 755
权限,即 -rwxr-xr-x
(我已经通过 FileZilla 确认了这一点)。
我可以从我的浏览器导航到 index.html
和 example.jpg
。但是,当我导航到 example.js
时,出现 404 错误)。
我发现这一点的方式是我的 index.html
没有执行 javascript。所以index.html
也看不到example.js
。
可能是什么原因造成的?
更新:在本地主机上,index.html 可以正常执行 javascript 文件。这一切都发生在远程服务器上。
[已解决] -- 在按照下面的评论进行操作后,
关注此评论后:
(当 Whosebug 允许时,我会将其标记为正确答案。)