This is my first time installing Magento and I feel quite stupid getting stuck so early in the proces. I followed the official documentation to install Magento 2.3 by the book.
- Fresh CentOS 7 installation on a dedicated VPS, only using root
- Using the official documentation: https://devdocs.magento.com/guides/v2.3/install-gde/prereq/nginx.html
- Installed NGINX, configured and well
- Installed MySQL, configured and well
- Installed PHP 7.1.24 (Webtatic), configured and well
- Succesfully tested a phpinfo-page to make sure NGINX and PHP-FPM are working properly
- Created a composer project (/usr/share/nginx/html/magento2) without any problems
- Set the file permissions like described in the offical documentation
- Installed Magento without any problems
- Opened a browser. Error 500.
When I check my NGINX logs there's all kind of different permission-related PHP fatal errors like "Can't write file", "Class did not generate properly" and "Directory permission is read only". Example:
2018/12/20 15:08:23 [error] 16213#0: *7 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Zend_Cache_Exception: cache_dir "/usr/share/nginx/html/magento2/var/page_cache" is not writable in /usr/share/nginx/html/magento2/vendor/magento/zendframework1/library/Zend/Cache.php:209
Stack trace:
#0 /usr/share/nginx/html/magento2/vendor/magento/zendframework1/library/Zend/Cache/Backend/File.php(180): Zend_Cache::throwException('cache_dir "/usr...')
#1 /usr/share/nginx/html/magento2/vendor/colinmollenhour/cache-backend-file/File.php(87): Zend_Cache_Backend_File->setCacheDir('/usr/share/ngin...')
#2 /usr/share/nginx/html/magento2/vendor/magento/zendframework1/library/Zend/Cache.php(153): Cm_Cache_Backend_File->__construct(Array)
#3 /usr/share/nginx/html/magento2/vendor/magento/zendframework1/library/Zend/Cache.php(94): Zend_Cache::_makeBackend('Cm_Cache_Backen...', Array, true, true)
#4 /usr/share/nginx/html/magento2/vendor/magento/framework/App/Cache/Frontend/Factory.php(156): Zend_Cache::factory('Magento\\Framewo...', 'Cm_Cache_Backen...', Array, Array, true, tr" while reading response header from upstream, client: ip.ip.ip.ip, server: server.com, request: "GET / HTTP/1.1", upstream$
I chmodded the whole Magento-directory to 777 (-R), but to no avail. I chowned from root:root to nginx:nginx, but to no avail.
When troubleshooting online I only read suggestions about apache users and www-data users, but I don't use Apache and I don't use Ubuntu.
What are the correct permissions for a pure CentOS 7 / NGINX setup?
Thanks :$
chown -R nginx:nginx /usr/share/nginx/html/magento2
but it didn't work.