A
A
Andrey Khokhlov2015-11-07 09:45:45
Nginx
Andrey Khokhlov, 2015-11-07 09:45:45

Nginx and website in home/username - how to set permissions correctly?

Ubuntu + nginx + php-fpm.
Standard setting according to the guide from the issuance of Google (like this one ). Root is not allowed to login, all configuration is done by username via sudo.
FTP access from this user to his directory using vsftpd.
There is a directory: /home/username/example.com/public_html
In nginx, a host with root is configured for this directory, but when I enter, I get a 403 Forbidden error.
The set of commands that I achieved:
1. Correct work on ftp (add, delete, etc.) under this user
2. index.html opens
3. Wordpress is installed (with the creation of a config file), plugins are installed, files are uploaded

sudo usermod -aG www-data username
sudo chown -R www-data:www-data /home/username/example.com/public_html
sudo chmod -R 0775 /home/username/example.com/public_html

I didn’t come up with it myself, it’s advised on both serverfault and DO .
But it is embarrassing that often in the comments someone, obviously bearded, frowns and writes they say so not very correctly. But why this is not correct and how then it is correct - I can not find.
Actually a question - how correctly that?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Puma Thailand, 2015-11-07
@andrhohlov

give rights only to the user and his group
in nginx set up work only from this user in php-fpm too

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question