1

I am trying to install fresh Magento 2. It gives me HTTP ERROR 500 when hit the URL http://localhost/m2/.

I know 0777 will solve my issue, but it is not good to give 777. I give permission as suggested. Please can any see below is there any file permission issue.

maddy@maddy:/var/www/html/m2$ ls -l
total 872
drwxr-xr-x  4 maddy maddy   4096 May 30 15:39 app
drwxr-xr-x  2 maddy maddy   4096 May 30 15:39 bin
-rw-r--r--  1 maddy maddy 435065 May 30 15:39 CHANGELOG.md
-rw-r--r--  1 maddy maddy   1843 May 30 15:37 composer.json
-rw-r--r--  1 maddy maddy 344683 May 30 15:39 composer.lock
-rw-r--r--  1 maddy maddy   3381 May 30 15:39 CONTRIBUTING.md
-rw-r--r--  1 maddy maddy    631 May 30 15:39 COPYING.txt
drwxr-xr-x  5 maddy maddy   4096 May 30 15:39 dev
-rw-r--r--  1 maddy maddy   2864 May 30 15:39 Gruntfile.js.sample
-rw-r--r--  1 maddy maddy   1368 May 30 15:39 index.php
-rw-r--r--  1 maddy maddy    315 May 30 15:39 ISSUE_TEMPLATE.md
drwxr-xr-x  4 maddy maddy   4096 May 30 15:39 lib
-rw-r--r--  1 maddy maddy  10376 May 30 15:39 LICENSE_AFL.txt
-rw-r--r--  1 maddy maddy  10364 May 30 15:39 LICENSE.txt
-rw-r--r--  1 maddy maddy   5071 May 30 15:39 nginx.conf.sample
-rw-r--r--  1 maddy maddy   1427 May 30 15:39 package.json.sample
-rw-r--r--  1 maddy maddy    814 May 30 15:39 php.ini.sample
drwxr-xr-x  2 maddy maddy   4096 May 30 15:39 phpserver
drwxr-xr-x  6 maddy maddy   4096 May 30 15:39 pub
drwxr-xr-x  7 maddy maddy   4096 May 30 15:39 setup
drwxr-xr-x  7 maddy maddy   4096 May 30 15:37 update
drwxr-xr-x  2 maddy maddy   4096 May 30 15:39 var
drwxr-xr-x 29 maddy maddy   4096 May 30 15:39 vendor
1

3 Answers 3

3

As per recommendations of Magento, the folder and file permission for Magento 2 installation should be like:

cd <your Magento install dir>
find . -type f -exec chmod 644 {} \;     # 644 permission for files
find . -type d -exec chmod 755 {} \;     # 755 permission for directory 
find ./var -type d -exec chmod 777 {} \; # 777 permission for var folder    
find ./pub/media -type d -exec chmod 777 {} \;
find ./pub/static -type d -exec chmod 777 {} \;
chmod 777 ./app/etc
chmod 644 ./app/etc/*.xml
chown -R :<web server group> .
chmod u+x bin/magento

Note that if you access files using FTP, the FTP user should be a member of the webserver group.

1

Run the command on root directory using terminal .

php bin/magento setup:upgrade

also clear the folder var/cache and then reindexing

php bin/magento indexer:reindex
1
  • Sir I will try this , let you know. Thank YOu
    – inrsaurabh
    Sep 26, 2017 at 5:20
0

cd find . -type f -exec chmod 644 {} ; # 644 permission for files find . -type d -exec chmod 755 {} ; # 755 permission for directory find ./var -type d -exec chmod 777 {} ; # 777 permission for var folder
find ./pub/media -type d -exec chmod 777 {} ; find ./pub/static -type d -exec chmod 777 {} ; chmod 777 ./app/etc chmod 644 ./app/etc/*.xml chown -R : . chmod u+x bin/magento

Then

php bin/magento setup:upgrade

Then

php bin/magento indexer:reindex

Then

sudo chmod -R 777 generated/ var/cache/ pub/static var

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.