How to give apache permission to write to home directory?

前端 未结 4 1224
深忆病人
深忆病人 2020-12-14 03:21

My server is in /var/www/html I have a php script in /var/www/html/fileio_test/io_test.php



        
4条回答
  •  無奈伤痛
    2020-12-14 03:55

    By default, Apache on Ubuntu runs as www-data.

    Let's assume your folder is located in /var/www/mysite.

    You can do this:

    chown -R www-data:www-data /var/www/mysite

    chmod -R og-r

    /var/www/mysite After doing this, www-data (the Web server) will have full access to the site's files, while other non-root users will have no access at all.

    If you wish to allow select users to access the site, you can make the folder group-readable and add those users to the group www-data.

    Set correct permissions on your apache files

提交回复
热议问题