AWS EC2 FTP/HTML

mkr*_*ral 11 apache amazon-ec2 amazon-web-services

我真的不太了解Apache,我遵循了一些教程并安装了LAMP堆栈.我可以成功ftp到/ home/ec2-user并在那里上传文件,但我希望能够将文件上传到/ var/www/html,或者只是在某处我可以使用我的帐户将文件上传到网络.

很抱歉,如果我的问题不是很有帮助,但我在服务器上的教育程度不够,无法提供更多信息.问我问题,我会尽我所能.

小智 30

首先确保你可以写入documentroot(在这种情况下是/ var/www/html)EC2上用户"ec2-user"的默认组是"ec2-user"和"wheel"

使用以下命令为/ var/www/html授予用户"ec2-user"所有权

sudo chown -R ec2-user /var/www/html
Run Code Online (Sandbox Code Playgroud)

或组"轮"所有权和写权限

sudo chgrp -R wheel /var/www/html
sudo chmod g+w /var/www/html
Run Code Online (Sandbox Code Playgroud)

第二步是将您的FTP客户端(Filezilla,Cyber​​Duck,...)设置为默认为/ var/www/html,或在指向docroot的主目录ec2-user中创建符号链接.

ln -s /var/www/html ~/docroot
Run Code Online (Sandbox Code Playgroud)

当您在ftp客户端上进行身份验证时,只需双击"docroot"文件夹即可.

需要注意的是,您的DocumentRoot可能未配置为/ var/www/html,请检查/etc/httpd/conf.d/*.conf中标有"DocumentRoot"的配置.

  • 对我来说,我所需要的只是`sudo chown -R ec2-user/var/www/html`.它为我解决了几个小时的悲伤.谢谢! (3认同)