Hello,
After moving from localhost (xampp) to VPS WHM & cPanel, on CentOS EasyApache5 I am facing huge issues with permissions.
I've read Magento docs, read many topics and still couldn't resolve it...
From Apache2 conf, Apache is running on user:group nobody:nobody.
Magento is installed in /home/website/public_html
On public_html i have user:group website:nobody
In public_html are folders are website:website
I've tried setting all folder in public html to website:nobody or nobody:nobody but then it's giving Internal Server error 500.
The only way to site works is to set up atleast 775 on pub. Then all already cached img are working.
But no new image or uploader is working untill I set up 777 on pub.
Of course this cant stay like this...
I've read about suPHP and many many things and still dont know how to change owner. So PHP scripts/apache would be run as user:group website:website so then i could reduce permissions to 770.
Please help ;(
If you enable suPHP / suEXEC, you will then be able to set all files to 644 and all directories to 755 which are way more secure.
If you are unsure about this, your hosting provider or system administrator should be able to assist you with it.
Here are some things you can try to resolve the file permission issues with Magento 2 on a VPS with WHM/cPanel and CentOS:
Set the user and group ownership of the Magento install and sub-directories to the website owner (website: website).
Ensure the website user is added to the Apache group for execute permissions.
Update permissions on key folders like pub, var, generated, and app/etc to 775. Other folders can be 770 or 755.
Enable suPHP handler in WHM for the website cPanel account to run PHP as a website user.
Check SELinux context is set properly on files with 'restorecon -R...'
Set umask 0002 for website user's shell to make new files group writable.
Add 'Options +FollowSymLinks' in .htaccess to enable symlink following.
Restart httpd after making changes.
The key points are to run PHP/webserver as website owner, not nobody/root, use proper permissions/umask, enable suPHP, and check SELinux contexts. This should help resolve the permissions issues with Magento on a VPS.
Try a code profiler like tideways or new relic. It will show you which code blocks are slow.
<img src="GSC_Issue.png" alt="hosting issue">
I was facing the same issue on my website universitiesbyworld.com hey if you find the solution please let me know