AWS EC2 FTP / HTML

2019-01-31 10:50发布

问题:

I really don't know much about Apache, I followed some tutorials and installed the LAMP stack. I can successfully ftp to /home/ec2-user and upload files there but I want to be able to upload files to the /var/www/html or just have somewhere where I can upload files to the web with my account.

Sorry if my question is not very helpful but I'm not educated enough on servers to provide more information. Ask me questions and I will do my best.

回答1:

First make sure you can write to the documentroot (/var/www/html in this case) The default groups for user "ec2-user" on EC2 is "ec2-user" & "wheel"

Either give user "ec2-user" ownership of /var/www/html with the following command

sudo chown -R ec2-user /var/www/html

Or group "wheel" ownership and write permissions

sudo chgrp -R wheel /var/www/html
sudo chmod g+w /var/www/html

Second step is to set your FTP client (Filezilla, CyberDuck, ...) to default to /var/www/html or create a symbolic link in the home directory ec2-user pointing to docroot.

ln -s /var/www/html ~/docroot

When you authenicate on your ftp client, just doubleclick on what looks like the "docroot" folder.

One caveat is that your DocumentRoot may not be configured as /var/www/html, please check your configurations in /etc/httpd/conf.d/*.conf labeled with "DocumentRoot".



回答2:

Here is a helpful answer, and at the end is a link to a video for Cyberduck. The text of the Filezilla explanation was enough for me to figure it out for Cyberduck.

Connect to Amazon EC2 file directory using Filezilla and SFTP