首頁  >  文章  >  CMS教程  >  WordPress不能將上傳的檔案移到wp-content/uploads

WordPress不能將上傳的檔案移到wp-content/uploads

藏色散人
藏色散人轉載
2020-12-03 14:29:263705瀏覽

下面由WordPress教學欄位來介紹WordPress中無法將上傳的檔案移到wp-content/uploads的解決方法,希望對需要的朋友有幫助!

WordPress不能將上傳的檔案移到wp-content/uploads

解決WordPress中無法將上傳的檔案移到wp-content/uploads

建置lnmp環境,放一個wordpress建置站系統

lnmp環境很快就搭建完成了,但是在放wordpress的時候出現了一些問題

#最主要的問題:

##1.第一個是wp -content/uploads沒有權限創建,

     這個自己手動創建一下,給個777權限就好了。

2.無法將上傳的檔案移到wp-content/uploads。

  這是個主要的問題,也是比較麻煩的問題,百度的答案都是千篇一律的設定777權限,不要中文用戶名,

  沒有一點用。

  在獲得解決辦法之前首先描述一下背景

  裝lnmp環境的時候全部是使用root用戶安裝的,但是當我放程序的時候是新創建了一個morequ用戶,程序全部放到這個用戶下,再用nginx代理。

  這就出現了權限問題。

  翻遍了百度,一點用都沒有,最後用bing搜尋得到了一個答案。

按照他的方法改了之後,連http都過不去,直接500了,經過多番努力,最後得到答案。

  a)修改nginx.conf

    在這個檔案的最開始,有個設定user的地方,修改為:

user  root root;
worker_processes  1;

#      b)修改php-fpm.conf

   在這個檔案裡看到這麼一句話:

; Include one or more files. If glob(3) exists, it is used to include a bunch of
; files from a glob(3) pattern. This directive can be used everywhere in the
; file.
include=/etc/php-fpm.d/*.conf

     可以進入這個資料夾看一下,其中有一個www.conf檔案

  修改這個檔案的:

; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many
; BSD-derived systems allow connections regardless of permissions.
; Default Values: user and group are set as the running user
;                 mode is set to 0666
;listen.owner = morequ
;listen.group = morequ
;listen.mode = 0666
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
;       will be used.
; RPM: apache Choosed to be able to access some dir as httpd
user = morequ
; RPM: Keep a group allowed to write in log dir.
group = morequ

   將原本的www用戶改為我目前的用戶。

  結果成功。

以上是WordPress不能將上傳的檔案移到wp-content/uploads的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:cnblogs.com。如有侵權,請聯絡admin@php.cn刪除