开发者

Give Apache Permission To Folder

开发者 https://www.devze.com 2023-03-08 03:17 出处:网络
I\'ve installed Centos5, installed a web ser开发者_运维技巧ver and set up virtual host. The host is pretty much set up like this:

I've installed Centos5, installed a web ser开发者_运维技巧ver and set up virtual host. The host is pretty much set up like this:

> adduser user1
> mkdir -p /home/user1/public_html/domain1.com/{public,private,log,cgi-bin,backup}
> chmod -R 755 /home/user1/public_html/

And I've added a VirtualHost entry in httpd.conf that looks like this:

<VirtualHost *:80>
#Blah blah blah
  DocumentRoot /home/user1/public_html/domain1.com/public
#Blah blah blah
</VirtualHost>

So apache can ready the directory just fine but has problems uploading files because the permission is denied. The scripting language is PHP.

How can I allow file uploads without making everything 777 permssion?


chown the directory to match Apache's configured username/groupname, and check where PHP is putting its uploads

Apache's user/group are defined by the User and Group .conf options, and PHP's upload dir is specified by the upload_tmp_dir .ini option.


make all folders 755 and change the owner to the user who is running apache. Usually in Centos should be httpd


upload files someplace other then the docroot

0

精彩评论

暂无评论...
验证码 换一张
取 消