2013-04-23 104 views
0

我在www-data用户没有写入权限的文件上记录错误。以下是错误日志文件的样子:Apache可以写入权限不足的文件

-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 [email protected] 
     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> 

你能不能解释一下?

+1

你是如何启动你的服务器? – 2013-04-23 03:25:43

+0

它在Ubuntu启动时自动运行。对于重新启动,我在终端上发出这个命令:sudo service apache restart – petwho 2013-04-23 03:30:01

回答

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