【问题标题】:Lighttpd can't get files mounted via sshfsLighttpd 无法获取通过 sshfs 挂载的文件
【发布时间】:2013-11-26 18:09:39
【问题描述】:

我有一个 CentoOS 6 服务器,其目录通过我的 Mac 目录中的 sshfs 挂载:

sshfs -o allow_other dmitri@10.211.55.2:/Users/dmitri/Sites /var/www/html

但是当我尝试启动 lig​​httpd 服务器时,我得到一个错误:

Starting lighttpd: 2013-11-20 10:34:43: (configfile.c.989) opening configfile  /var/www/html/www.example.ru/public/_engine/lighttpd.conf failed: Permission denied

Lighttpd 用户是 lighttpd,但是当我切换到用户 lighttpd 时:

su lighttpd -s /bin/bash

我可以读取挂载目录中的任何文件:

bash-4.1$ whoami
lighttpd
bash-4.1$ cat /var/www/html/www.example.ru/public/_engine/lighttpd.conf
server.error-handler-404 = "/zf2.php/404"
...

我不明白为什么会发生这种情况以及如何使 lighttpd 工作。

PS(这会很有用):

bash-4.1$ whoami
lighttpd
bash-4.1$ pwd
/var/www/html/www.example.ru/public/_engine
bash-4.1$ ls -lh
-rw-r--r--. 1 501 games 2,3K Ноя 15 09:48 account-pages.php
-rw-r--r--. 1 501 games  23K Ноя 15 09:48 admin-pages.php

【问题讨论】:

    标签: lighttpd centos6 sshfs


    【解决方案1】:

    您需要授予 lighttpd 访问文件的权限。卸载文件系统,运行以下命令以授予 lighttpd 对您的 web 目录的所有权,然后再次安装文件系统。

    Chown -R lighttpd:lighttpd /var/www/html
    

    【讨论】:

      【解决方案2】:

      真正的麻烦制造者是 SELinux。禁用后所有问题都解决了。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-11-24
        • 1970-01-01
        • 1970-01-01
        • 2014-10-22
        • 1970-01-01
        • 2012-08-05
        • 1970-01-01
        • 2019-09-21
        相关资源
        最近更新 更多