A
A
Alexander Yerko2017-11-13 20:12:55
linux
Alexander Yerko, 2017-11-13 20:12:55

How to correctly set permissions for apache when virtual hosts are located in the home folder?

Previously, I developed sites only under windows + openserver, now I started to study linux.
I store all sites in bitbucket repositories, test them on local domains, then upload them to the hosting, so it's convenient to have all projects close at hand.
First, I installed apache2, php, mysql.
All sites must be kept in the home folder, I created the www folder in it for this, set the rights to 0775 on it
. The virtual host configs are as follows:

site.loc.conf
<VirtualHost *:80>
  ServerName site.loc

  ServerAdmin [email protected]
  DocumentRoot /home/user/www/site

  <Directory />
    AllowOverride All
  </Directory>
  <Directory /home/user/www/site>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
    Require all granted
  </Directory>

  ErrorLog /home/user/www/_logs/site_error.log
  CustomLog /home/user/www/_logs/site_access.log combined
</VirtualHost>

I ran into the following problem: when php scripts create folders or files themselves, I, as a user, lose access to them.
How to properly configure the rights so that both apache and I can use the contents of directories with sites with the same rights?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2017-11-13
@Stalker_RED

permissions-calculator.org/decode/0775

me as a user
probably the user under which you log in is in some other group.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question