Skip to content

Instantly share code, notes, and snippets.

@stiplady
Last active August 19, 2016 09:19
Show Gist options
  • Select an option

  • Save stiplady/725aa59a8852ba133522ab3ec3989b91 to your computer and use it in GitHub Desktop.

Select an option

Save stiplady/725aa59a8852ba133522ab3ec3989b91 to your computer and use it in GitHub Desktop.
Script to configure or reset permissions for a Magento installation where the nginx/apache user is different from the FTP user Raw
# Based on the following guide with a few amendments
# http://devdocs.magento.com/guides/m1x/install/installer-privileges_after.html
# Start by setting all files/folders to be owned by the project user
chown -R projectuser:nginx .
# Webserver needs access to these folders for file upload, logging etc
chown -R nginx:nginx var/ media/
# Set read/write/execute permissions for files and folders
# Project user full access and web server read/execute (no write)
find . -type f -exec chmod 640 {} \;
find . -type d -exec chmod 750 {} \;
# Modify permissions for the var and media folders
# Both the project user and webserver need access to these files
find {var,media}/ -type f -exec chmod 660 {} \;
find {var,media,includes}/ -type d -exec chmod 770 {} \;
# Allow Magento to set the compile settings
chmod 660 includes/config.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment