0

I tried to transfer my CodeIgniter website to /var/www/html located within my Amazon EC2 micro instance using FileZilla. However, the transfer was unsuccessful as I received hundreds of transfer errors while attempting to transfer my CodeIgniter website.

My question is, how do I upload my CodeIgniter website to /var/www/html ?


The results of sudo ls -l /var/www are:

drwxrwxrw- 2 root root 4096 Apr 30 22:54 cgi-bin drwxrwxrw- 3 root root 4096 May 22 12:25 error drwxrwxrw- 2 root root 4096 Jan 6 2012 html drwxrwxrw- 3 root root 4096 May 22 12:25 ic

4
  • 1
    What exactly are you getting for errors?
    – Nathan C
    May 23, 2013 at 11:14
  • +1 Thanks for your reply Nathan. I got permission errors: "/var/www/html/test.txt: open for write: permission denied Error: File transfer failed"
    – Anthony
    May 23, 2013 at 11:29
  • I used FileZilla to drag and drop my website to that location.
    – Anthony
    May 23, 2013 at 11:30
  • 1
    Looks like a permissions issue. I'll write up some instructions.
    – Nathan C
    May 23, 2013 at 11:32

1 Answer 1

3

By default, ec2-user (the default Amazon AMI user) lacks permissions to the /var/www directory. To fix it, use:

usermod -a -G www-data ec2-user

This will add your ec2-user to apache's group so you can make the edits. Root is unable to log in via SSH by default (this can be adjusted, though) so this will work as a workaround. If the apache user is different, change www-data to the appropriate user.

15
  • 1
    In ps aux, the user is the first column. Look for a line that shows /usr/sbin/httpd and the first column will have the name of the user. Typical names are "apache2", "apache", or "www-data".
    – Nathan C
    May 23, 2013 at 12:14
  • 1
    That's probably because the apache user is different. :-)
    – Nathan C
    May 23, 2013 at 12:16
  • 1
    No, you shouldn't have to. Try this: chmod -R 776 /var/www. This should put the permissions as they should be.
    – Nathan C
    May 23, 2013 at 12:29
  • 1
    Hm, your permissions are screwed up it looks like. Can you update your question with the output of ls -l /var/www?
    – Nathan C
    May 23, 2013 at 12:54
  • 1
    I see, they're all owned by root. Type chown -R apache:apache /var/www to replace with the proper owner, where apache is your httpd's user. That'd by why it wasn't working :-)
    – Nathan C
    May 23, 2013 at 13:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.