Question

I installed a LAMP in my AWS EC2 instance. The DocumentRoot folder is in /var/www/html. What I did is to copy the html folder into my /home/ec2-user and rename it to www. Then the DocumentRoot is changed to /home/ec2-user/www. Of course the https.conf is changed accordingly. Here it is:

#DocumentRoot "/var/www/html"
DocumentRoot "/home/ec2-user/www"

<Directory />
    #Options FollowSymLinks
    #AllowOverride None
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order deny,allow
    Allow from all    
</Directory>

#<Directory "/var/www/html">
<Directory "/home/ec2-user/www">

The problem is I got the following error message after I restart the https service.

You don't have permission to access / on this server.

The owner and the permission is the same for both folder. Here are the screenshots:

enter image description here enter image description here

I searched in stack overflow and found some similar issues. But none of them work for me. Can anybody help? Thanks

Was it helpful?

Solution

the issue is the user apache runs as, is not ec2-user.

You could change it, but putting your doc root inside of the ec2-user's home directory is probably not a good idea. More then likely everything you do on your instance is as the ec2-user (who is a sudoer and has access to pretty much everything), so if someone was to compromise a script that apache is running, they would literally have full control over your instance.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top