How to configure Apache to work on behalf of the user mypc and not from www-data?
I read a lot of forums and write everywhere to do so.

1 - Edit the file / etc / apache2 / envvars

поменять это 

export APACHE_RUN_USER = www-data
export APACHE_RUN_GROUP = www-data

 на это 

export APACHE_RUN_USER = mypc
export APACHE_RUN_GROUP = mypc

Everyone can not understand, everyone writes that everything worked for them and everything is fine. But my Apache after that simply refuses to run, as I change the settings to the old, everything works. What is wrong here?

    1 answer 1

    Problem solved, I will write below in order it may need someone.
    Ubuntu OS 16.04 LTS
    Apache2 + PHP7.0-fpm

    for starters, it is advisable to backup / etc / php and / etc / apache2
    (I did not, I like to risk)

    1 - for starters, open temrinal and add a user to your group, if the username is mypc then:

     adduser mypc mypc 

    2 - go to / etc / apache2 / write in the terminal gedit envvars

    find the lines:

     export APACHE_RUN_USER=www-data export APACHE_RUN_GROUP=www-data 

    boldly change them to

     export APACHE_RUN_USER=mypc export APACHE_RUN_GROUP=mypc 

    3 - systemctl restart apache2

    This is what apache will issue

     Job for apache2.service failed ...... 

    4 - open the terminal and enter

     journalctl | tail 

    AH00526: Syntax error on line 4 of /etc/apache2/mods-enabled/fastcgi.conf

    / var / lib / apache2 / fastcgi: can't create dynamic directory

    5 - Open Nautilus from under root, give rights and make the user mypc the owner of /var/lib/apache2/fastcgi

    6 - systemctl restart apache2
    [ok] Restarting apache2 (via systemctl): apache2.service.
    apache2.service - active (running)

     127.0.0.1/info.php 

    will issue

     Internal Server Error = PHP не хочет работать. 

    8 - Open the Terminal and enter

     grep -r www-data /etc/php/7.0/ /etc/php/7.0/fpm/pool.d/www.conf:user = www-data /etc/php/7.0/fpm/pool.d/www.conf:group = www-data /etc/php/7.0/fpm/pool.d/www.conf:listen.owner = www-data /etc/php/7.0/fpm/pool.d/www.conf:listen.group = www-data 

    9 - open all these files one by one through gedit and change www-data to mypc

    10 - Open Nautilus from under root and give mypc rights to the /etc/php/ folder

    11 - Open Nautilus from under root and give mypc rights to the /etc/apache2/ folder
    Launch 127.0.0.1/info.php and enjoy life.
    You no longer have to distribute access rights for each folder.

    This is recommended to practice on local hosting,
    for all other cases there is libapache2_mpm_itk, I was too lazy to configure it,
    I did not find any sensible information in the internet, so I did as described above.