在Amazon EC2(Amazon Linux)上设置WordPress的权限 [英] Setting up permissions for WordPress on Amazon EC2 (Amazon Linux)

查看:98
本文介绍了在Amazon EC2(Amazon Linux)上设置WordPress的权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Amazon EC2实例上设置了WordPress.它使用Amazon Linux,是一个标准设置(仅php5和mysql).

I setup WordPress on an Amazon EC2 instance. It's using Amazon Linux and is a standard setup (just php5 and mysql).

WordPress工作正常,但是存在一些权限问题.具体来说,我无法上载媒体,更新永久链接,插件等.我在ec2-user下没有写许可,并且由于我通过WinSCP上载了所有文件,因此当前所有者是ec2-user.

WordPress works fine, but there's some permission issues. Specifically I can't upload media, update permalink, plugins, etc. I have no write permission under the ec2-user and because I uploaded all the files over WinSCP the current owner is ec2-user.

我的问题是更正此问题的最佳方法是什么?我可能可以通过将所有文件夹/文件的所有权更改为root来解决此问题,但这不是一个非常优雅或动态的解决方案.

My question is what's the best way to correct this issue? I could probably fix it by changing ownership of all folders/files to root, but that's not a very elegant or dynamic solution.

我的Web目录的路径是/var/www/html.我可以允许ec2-user拥有正确的权限吗?也许通过建立一个Apache用户和ec2-user共享的组?

The path to my web directory is /var/www/html. Can I allow the ec2-user the correct permissions? Perhaps by having a group that both the Apache user and ec2-user share?

任何想法都会受到赞赏

推荐答案

请参见 http://blog.david-jensen.com/development/wordpress-amazon-ec2-apache-permissions-wordpress/以及其他Google搜索结果.他看起来好运:

See http://blog.david-jensen.com/development/wordpress-amazon-ec2-apache-permissions-wordpress/ among other Google results. He looks to have had good luck:

我一直在努力找出Amazon EC2 Apache的设置权限以使WordPress能够管理所有文件在没有WordPress的我的Amazon EC2实例上要求FTP权限当我尝试通过管理网站上传插件或主题时.我结束了必须给我的html文件夹中文件的文件所有权和组所有权使WordPress用户正常运行. http://www.chrisabernethy.com/why-wordpress-asks-connection-info/和它的评论帮助我得出了这个结论.

I have been doing my best to figure out the Amazon EC2 Apache setup of permissions to enable WordPress to be able to manage all of the files on my Amazon EC2 instance without WordPress asking for FTP permissions when I try to upload a plugin or theme via the Admin site. I ended up having to give file and group ownership of the files in my html folder to apache user for WordPress to run correctly. http://www.chrisabernethy.com/why-wordpress-asks-connection-info/ and its comments helped me reach this conclusion.

从网页上:

运行

sudo su chown -R apache:apache /vol/html

然后我将权限设置为强化的WordPress指南为我的html根目录推荐的内容,因为当我运行具有多个域的MultiSite时,所有的WordPress文件都已存在.

I then set permissions to what the hardening WordPress guide recommends for my html root as all my WordPress files are there as I am running MultiSite with multiple domains.

find /vol/html/ -type d -exec chmod 755 {} \;
find /vol/html/ -type f -exec chmod 644 {} \;

由于apache没有登录,我认为这值得冒险,尽管可能有更好的方法.然后,我将ec2-user添加到apache组中,并将wp-content文件夹的权限更改为具有组写入权限775.

As apache doesn’t have a login I feel this is worth the risk though there is probably a better way to do this. I then added ec2-user to the apache group and changed the permissions of the wp-content folder to have group write permission 775.

useradd -G apache ec2-user
sudo chmod -R 775 /vol/html/wp-content

这使FileZilla或以ec2用户身份登录的任何其他程序只能更改wp-content文件夹中的文件和文件夹.如果有人对此有更好的了解,我想知道.我只使用SSH和SFTP通过密钥文件访问服务器.

This allows FileZilla or any other program logged in as ec2-user the ability to change files and folders in the wp-content folder only. If anyone has a better way of doing this I would like to know. I am only using SSH and SFTP to access the server with key files.

这篇关于在Amazon EC2(Amazon Linux)上设置WordPress的权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆