0

我在 www-data 用户无权写入的文件上记录错误。这是错误日志文件的样子:

-rw-r--r-- 1 root      root      549050 Th04 23 10:01 access.log
-rw-r--r-- 1 root      root       35495 Th04 23 10:12 error.log

但是我仍然看到,当服务器出现错误时,error.log 仍然被修改。

这是我的apache配置:

<VirtualHost *:80>
        ServerAdmin webmaster@magento.local.com
        ServerName magento.local.com
        DirectoryIndex index.php index.html
        DocumentRoot /var/www/magento.local.com/public
        LogLevel warn
        ErrorLog /var/www/magento.local.com/log/error.log
        CustomLog /var/www/magento.local.com/log/access.log combined
</VirtualHost>

你能给我解释一下吗?

4

1 回答 1

0

你能复制并粘贴错误吗?Apache 可能无法写入 /var/www/magento.local.com/var 或 /var/www/magento.local.com/media 中的文件(或创建目录)。

试试下面的脚本。将其复制到 /var/www/magento.local.com 中名为 magento_perms.sh 的文件中,然后不带引号运行“sudo bash magento_perms.sh”。

#!/bin/bash

if [ ! -f ./app/etc/local.xml ]; then
    echo "-- ERROR"
    echo "-- This doesn't look like a Magento install.  Please make sure"
    echo "-- that you are running this from the Magento main doc root dir"
    exit
fi

if [ `id -u` != 0 ]; then
    echo "-- ERROR"
    echo "-- This script should be run as root so that file ownership"
    echo "-- changes can be set correctly"
    exit
fi

find . -type f \-exec chmod 644 {} \;
find . -type d \-exec chmod 755 {} \;
find ./var -type d \-exec chmod 777 {} \;
find ./var -type f \-exec chmod 666 {} \;
find ./media -type d \-exec chmod 777 {} \;
find ./media -type f \-exec chmod 666 {} \;
chmod 777 ./app/etc
chmod 644 ./app/etc/*.xml
于 2013-04-23T03:32:10.927 回答