Web permissions issues for Nginx server

Source: Internet
Author: User
Tags nginx server

Sometimes our site root directory will be migrated from one directory to another directory, if our server is using Nginx or Apache, we usually configure the site root directory and then directly to the site decompression or upload to the root directory, This causes the problem is unable to do anything to the file caused the exception of the site, which is the most common in the framework, the local run good site, after uploading to the server suddenly can not access, there are many errors, this is the problem of permissions under Linux, some of the online methods are very rude use of chmod- R 777 DirName All the file permissions to open all, in fact, this can solve the problem, but not the best solution, if we understand the Linux system user rights and so the problem has a better solution, the following with Nginx server as an example to see

First of all, the default site directory is 755 permissions and our default permissions under the root user is also the user's permissions, that is, the directory of the user and user groups are root, when we visit the site, the browser makes the request, the service side of the corresponding resource processing requests, if involved in file modification or new operation, Service-side program is responsible for execution, because the server program is the Nginx and the corresponding language interpretation module is responsible for execution, so first of all the servers to have permission to modify the site directory, we open the Nginx server configuration file nginx.conf, the first row is Nginx execution of the user and group settings

  

We can create a new user dedicated to the Web site and FTP upload files, the user is not logged in, so the establishment of the time to use/sbin/nologin to build, we see the permissions of the Nginx server is www so at this time we practice is to change the site root directory permissions to www, the command is:

chown -r-v www:root/www/wwwroot

  In this way, site users and groups of the permissions are WWW and root, the server as a user's read and write is not any problem, this time if the service side automatically set up the file user rights for the WWW Group permission is also WWW, so that has full control and limited access to the right,

In addition, sometimes we use the Web page Rich Text editor will encounter the issue of permissions, resulting in the inability to upload files or set up a directory, this time we only need to manually change the upload directory permissions of 777, such as: chmod 777 upload may be because the editor and the front end of the use of JS interaction, So it's not exactly the Nginx server.

After the above steps, the permissions issue is resolved when you deploy the Web site on Linux.

Web permissions issues for Nginx server

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.