搭建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用户改成我当前的用户。
结果成功。