I created a LAMP server in Debian 10 on Google Compute Engine.
Instead of using /var/www/site/html I want to use /home/user/site/public_html as a root directory for site.
I added following code in /etc/apache2/apache2.conf to enable home directory for sites.
<Directory /home/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
The permissions for public_html for all sub directories is 775 and for all files is 664.
Ownership for all files and folders including public_html is user:www-data
My site is installed and running but I am unable to install any of plugins because WP is unable to write to the directory. I am getting this message when I try to install plugin.
How to Fix this issue?
EDIT
However if I set the ownership to www-data:www-data then I can install plugins but in this case the user can’t use FTP to make any changes to the folder.
Please guide me how can I achieve both.
The solution that comes to my mind is that the user gets the sames rights as that of www-data. In that case we can assign ownership as user:user. So FTP will also work and Plugins will also be able to install.
But I don’t know how to achieve this i.e. to assign the rights of www-data to any user?
2
Answers
I have got one solution. If I add the user to www-data group using following command
then user can make changes to the folder once accessed through FTP.
I could find the solution by installing an apache module mod_ruid2. For this the following article helped alot.
[https://www.jamroom.net/brian/documentation/guides/1202/configuring-apache-with-mod-ruid2]
But before you may need to install apsx for apache
The apache config file for each site shall include following code in the virtual host