How to change user/groups, permission with Magento 2, Nginx, PHP-fpm
How to change user/groups, permission with Magento 2, Nginx, PHP-fpm
Make sure the local workstation installed Nginx, php7.2-fpm on ubuntu.
1, Get a current user name
echo ${USER}
2, Change user/group run with current user:
sudo vim /etc/php/7.2/fpm/pool.d/www.conf
Find to the line and change to the current user:
user = <current-user>
group = <current-user>
listen.owner = <current-user>
listen.group = <current-user>
EX:
user = dylan
group = dylan
group = dylan
listen.owner = dylan
listen.group = dylan
3, Add user to group
sudo adduser www-data <current-user>
EX: sudo adduser www-data dylan
4, Change all permission, own in workspace Magento 2
Go to Magento 2 folder and run the command:
sudo chown -R ${USER}:${USER} .
sudo find -type f -exec chmod 755 {} \;
5, Restart php-fpm, nginx
sudo systemctl restart php7.2-fpmsudo systemctl restart nginx
Post a Comment