Skip to content
IT // Adventures

Permissions for an nginx Development Environment

1 min read

A warning right at the start: the permissions described in this article are meant for a development environment. In a production environment, the permissions should be set far more restrictively!

On my CentOS development server, nginx runs under the user of the same name. To edit the files, I use an additional user “tom”, who is a member of the “nginx” group. The websites are stored in the /srv/www directory. To be able to edit them reasonably comfortably from the client via SSH/SFTP, “nginx” should be set as the owner and group of the files and directories. The /srv directory itself belongs to “root:root” to increase security slightly:

chown -R nginx:nginx /srv/www
find /srv/www/ -type f -exec chmod 664 {} \;
find /srv/www/ -type d -exec chmod 775 {} \;
chmod -R g+s /srv/www/site1 /srv/www/site2 /srv/www/site3
chown root:root /srv/www

Sources