The error "unable to move uploaded files to" In wordpress in nginx

Source: Internet
Author: User
Tags wordpress version

Previously, Shanda cloud server was installed with an apache server on ubuntu, but the website always lost its response inexplicably. It was necessary to restart apache to provide normal services. There was no exception in reading logs, I am too lazy to study it. I just want to change it to nginx. It is easier to move wordpress from apache to nginx. Copy the source file to the nginx root directory without modifying the code.Rewrite Rules for wordpress under nginxYou can. However, when I write an article and send an image, I am prompted that "the uploaded file cannot be moved to the" Upload directory "error. Today (), this error can also be solved in the same way. An http error [crit] 22919 #0: * 600783 open () error occurs during image uploading on nginx () "/usr/local/nginx/client_body_temp/0000000017" failed (13: Permission denied) based on your own experience and online materials, the following troubleshooting methods are summarized: 1. on the Chinese file name website, many websites say that you can modify the upload file name to all English letters. I tried it and failed. Because I use the latest Chinese wordpress version, and I have uploaded attachments with Chinese names before using apache. Therefore, this method does not work. If you are using the new wordpress version, you can ignore this method. 2. If you do not have the write permission on the folder, you cannot upload the folder. You can simply set the permission to 777 so that everyone can write the folder. However, to ensure security, you only need to ensure that the folder owner is writable, that is, you can view the upload Directory In 755. ls-l and find that the owner has the write permission of 755. Continue to troubleshoot other issues. 3. the php process is different from the nginx process running user because my nginx uses the quancha user to run the parameter specified by the user in nginx. conf. However, the php-fpm process is run by the www-data user. For details, see. Ps-ef | grep quancha ps-ef | grep php-fpm
The upload function is completed using the php program, that is, the php-fpm process user writes the wordpress upload directory. However, the upload directory is located in the nginx html directory and the owner is the running user of nginx. That is to say, you can't write the quancha user's folder using www-data. Solution: 1. Modify the user command in nginx. conf to the www-data user. 2. restart nginx kill-QUIT 'cat/usr/local/nginx/nging. pid '; sudo/usr/local/nginx 3. modify the folder Directory attribute chown-R www-data: www-data/usr/local/nginx
 

Related Article

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.