Skip to content

Instantly share code, notes, and snippets.

@joeyhipolito
Created January 18, 2015 20:41
Show Gist options
  • Save joeyhipolito/7e9c03313a23d9049e28 to your computer and use it in GitHub Desktop.
Save joeyhipolito/7e9c03313a23d9049e28 to your computer and use it in GitHub Desktop.
Fixing permissions in /var/www or /usr/share/nginx/www
Repeatedly, you'll be fixing permissions, ownership in these directories `/var/www` or `/usr/share/nginx/www` whenever you are deploying your websites.
Here are the commands to save you some time
**apache**
sudo add-user $(whoami) www-data && \
sudo chown -R www-data:www-data /var/www && \
sudo chmod -R g+rw /var/www; find /var/www -type d -print0 | sudo xargs -0 chmod g+s
**nginx**
sudo add-user $(whoami) www-data && \
sudo chown -R www-data:www-data /usr/share/nginx/www && \
sudo chmod -R g+rw /usr/share/nginx/www; find /usr/share/nginx/www -type d -print0 | sudo xargs -0 chmod g+s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment