搭建lnmp環境,放一個wordpress建站系統php
lnmp環境很快就搭建完成了,可是在放wordpress的時候出現了一些問題html
最主要的問題:nginx
1.第一個是wp-content/uploads沒有權限建立,web
這個本身手動建立一下,給個777權限就行了。apache
2.沒法將上傳的文件移動至wp-content/uploads。less
這是個主要的問題,也是比較麻煩的問題,百度的答案都是千篇一概的設置777權限,不要中文用戶名,socket
沒有一點用。wordpress
在得到解決辦法以前首先描述一下背景php-fpm
裝lnmp環境的時候所有是使用root用戶安裝的,可是當我放程序的時候是新建立了一個morequ用戶,程序所有放到這個用戶下,而後用nginx代理。spa
這就出現了權限問題。
翻遍了百度,一點用都沒有,最後用bing搜索獲得了一個答案。
原文地址:http://www.aspku.com/cms/wordpress/55720.html
按照他的方法改了以後,連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用戶改成我當前的用戶。
結果成功。