Apache和linux文件权限无法浏览文件或目录
我刚刚将我的 magento 站点复制到运行 CentOS 5.4 的本地服务器。浏览器表示无法找到样式表的位置。样式表位于 /skin/frontend/my_new_interface/design2/css 中。我尝试在浏览器中查看,但无法查看 css 目录中的任何文件。我验证了一百万次,确认我输入的位置正确。我可以查看 /skin/frontend/my_new_interface/design2 中的文件。但是无法在浏览器中浏览目录。
我输入 ls -l css
并得到:
-rwxr-xr-x 1 apache apache
列出了我尝试过的所有文件
chmod -R 755 和
我更改了 apache conf 选项索引的目录
但是当我浏览目录时我仍然得到禁止。但是,在同一 www 目录中另一个全新安装的 magento 中,我可以浏览目录。据我所知,这两个安装具有相同的所有权和权限。
我也尝试了
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
magento wiki 中推荐的方法,但
我已经没有想法了。
I just copied my magento site over to a local server running CentOS 5.4. The browser said it can't locate the location of the stylesheets. The stylesheets are within /skin/frontend/my_new_interface/design2/css. I tried to view in the browser and I can't view any of the files within the css directory. I verified a million times that I'm typing in the correct location. I can view files within /skin/frontend/my_new_interface/design2. Can't browse directories within browser however.
I typed in ls -l css
and get:
-rwxr-xr-x 1 apache apache
listed for all the files
I tried chmod -R 755 and the directories
I changed the apache conf Options Indexes
But still when I browse the directories I get Forbidden. However, in another fresh installation of magento in the same www dir, I am able to browse directories. As far as I can tell both installations have same ownership and permissions.
I also tried
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
which was recommended in the magento wiki
I've just run out of ideas.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要将
Options +Indexes
添加到httpd.conf
或css/
中的.htaccess
文件中code> 文件夹,通过浏览器查看文件夹内容。不过,这很糟糕。您真的需要打开它吗?还是可以通过 ssh 会话继续执行此操作?在CSS文件注释中,您可以在CSS目录中输入
pwd
吗?这将帮助我们确认您的位置正确。当您尝试查看 CSS 文件目录时,或者只是当您尝试查看目录内容时,是否会收到“禁止”消息?You'll need to add
Options +Indexes
to yourhttpd.conf
or in a.htaccess
file in thecss/
folder to view the folder contents through the browser. This is bad ju-ju though. Do you really need to switch this on, or can you keep doing it through the ssh session?On the CSS file note, can you type
pwd
when in the CSS directory? That'll help us confirm you've got the correct location. Do you get "Forbidden" when you try to view the CSS file directory, or just when you try to view the directory contents?文件权限设置正确。我发现 .htaccess 为导致问题的 css 目录设置了重写规则。我继承了这个网站,但仍然不知道整个过程中所做的所有小修改。
The file permission were set up correctly. I figured out that the .htaccess had a rewrite rule set for the css directory that was causing the problem. I inherited this site and am still not aware of all the little modifications done throughout.