"Recommended" How to plan Nginx Site Directory permissions (user, user group, SSH,SFTP)

Source: Internet
Author: User
Tags php website centos server

From the previous article: PHP website (nginx, PHP-FPM, MySQL) User rights analysis, you can learn how Nginx and PHP-FPM users are working.

There is a working scenario:

1, the company has a CentOS server running several websites, each site is maintained by different teams, if you make sure that the FTP update files, do not update the wrong, not disorderly channeling. How to avoid the original to a site update files, the results uploaded to the B site, and so on chaos like;

2, only with the use of CentOS with SFTP, do not intend to install VSFTPD and other third-party FTP software;

3, the Site Directory reference is as follows:

/usr/local/nginx/www/test.cnblogs.com

/usr/local/nginx/www/www.cnblogs.com

Solution:

1, the website user (nginx,php-fpm,ftp user) all belong to the WWW user group;

2, nginx,php-fpm all use the user www;

3. Create a new independent FTP user for each website;

4, each website, FTP user has read, write, execute the permission, php-fpm the user only read, execute the permission (individual cache file/folder open Write permission);

5. The reference code is as follows:

##################################################### Modify site www.cnblogs.com directory permissions ################################## ################# new Account Useradd ftp_cnblogs_www-g wwwpasswd ftp_cnblogs_www          # Password: ftp_cnblogs_www_123# Modify Permissions Chown-r Ftp_cnblogs_www:www/usr/local/nginx/www/www.cnblogs.comchmod-r 750/usr/local/nginx/www/www.cnblogs.comchmod-r 760/usr/local/nginx/www/www.cnblogs.com/datachmod-r 760/usr/local/nginx/www/www.cnblogs.com/write2.txt######### ############################################ Modify site test.cnblogs.com directory permissions ########################################## ######### new Account Useradd ftp_cnblogs_test-g wwwpasswd ftp_cnblogs_test         # Password: ftp_cnblogs_test_123# Modify Permissions Chown-r ftp_ Cnblogs_test:www/usr/local/nginx/www/test.cnblogs.comchmod-r 750/usr/local/nginx/www/test.cnblogs.comchmod-r 760 /usr/local/nginx/www/test.cnblogs.com/datachmod-r 760/usr/local/nginx/www/test.cnblogs.com/write2.txt

Note:SFTP itself has other aspects of the security configuration, such as allowing users to only access their home directory,,, interested students can go under the study!

"Recommended" How to plan Nginx Site Directory permissions (user, user group, SSH,SFTP)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.