In accordance with AWS, Apache httpd serves files that are kept in a directory called the Apache document root. The Amazon Linux Apache document root is /var/www/html, which by default is owned by root. (Your case may be /var/www/html/xxxx/public_html where you have made directory) To allow the ec2-user account to manipulate files in this directory, you must modify the ownership and permissions of the directory. There are a few ways to perform this task. AWS tutorial suggests, you add ec2-user to the apache group, to give apache group ownership of the /var/www directory and assign write permissions to the group.
Add your user (ec2-user) to the apachegroup
$sudo usermod -a -G apache ec2-user
Change the group ownership of /var/www and its contents to the apache group.
$sudo chown -R ec2-user:apache /var/www (Do not forget to add your directories, /var/www/html/xxxxx/xxxx/xxx)
If you are using the SSH client (Linux, Ubuntu) and downloed the file and copied in the Downloaded folder.
$chmod 400 x.pem (x.pem, replace with your pem file)
If your subnet is configured to get public IP automatically, then every reboot you get new IP address and as such your public dns changes.
If you are using EC2 Instance connect, please check your security group.
Please navigate this link:
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-lamp-amazon-linux-2.html
Please let me know, I am also learning.
Relevant content
- asked 12 days ago
- asked 3 years ago
- asked a year ago
- asked a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 9 months ago
- AWS OFFICIALUpdated 2 years ago