WordPress 安装权限问题

Installation failed: Could not create directory. /wp-content/upgrade

在初用 wordpress 时,安装主题遇到了这个权限问题,参考https://stackoverflow.com/questions/37157264/wordpress-plugin-install-could-not-create-directory后,我尝试在 wordpress 根目录用这个命令解决安装权限问题,实际上我的 nginx 的用户不叫这个,所以下面三条对我不起作用

sudo chown -R www-data:www-data wp-content/plugins/
sudo chmod 775 wp-content
sudo chown -R www-data:www-data wp-content/

我用下面这个指令来查询了我的 nginx 用户

ps aux | grep nginx

输出了

root       23807  0.0  0.2 170120  2980 ?        Ss   Nov28   0:00 nginx: master process /www/server/nginx/sbin/nginx -c /www/server/nginx/conf/nginx.conf
www        39116  0.0  1.0 191700 10184 ?        S    Nov28   0:15 nginx: worker process
www        39117  0.0  0.5 191700  5472 ?        S    Nov28   0:00 nginx: worker process
www        39118  0.0  0.2 170104  2332 ?        S    Nov28   0:04 nginx: cache manager process
root      245143  0.0  0.2   6332  2076 pts/0    S+   03:49   0:00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox --exclude-dir=.venv --exclude-dir=venv ngin

可以看出,我的 nginx 客户端用户是 www

改命令为

sudo chown -R www:www wp-content/plugins/
sudo chmod 775 wp-content
sudo chown -R www:www wp-content/

后就可以安装啦

Leave a Reply

Your email address will not be published. Required fields are marked *