sudo chown -R www-data:www-data /var/www/example.com

Category: VPS Management

sudo chown -R www-data:www-data /var/www/example.com

Give the web server ownership of the site

chown -R recursively hands /var/www/example.com to www-data, the user nginx workers run as, so the server can read (and if configured, write) the site files. Files owned by root would still be readable if permissions allow, but www-data ownership is the convention. Use -R with care on trees containing secrets.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.