Search code examples
amazon-web-servicesamazon-ec2sshputty

How do I get port 80 to actually open on AWS ec2 instance?


I am trying to follow THIS tutorial to set up a LAMP on my ec2, with the eventual goal of setting up a WordPress blog on the instance. I've set the security group as follows: LINK TO PICTURE OF MY SECURITY GROUP INBOUND RULES

I've completed the setup via PuTTY and am SSHing into the instance just fine. I ran the chkconfig --list httpd command, which output httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off just like it should, and then I tried entering the public IPV4 address into my browser, it doesn't give me the apache test page, but rather this: image of port 80 not actually being open, after all

I am using the following AMI: amzn-ami-hvm-2018.03.0.20190611-x86_64-ebs

Help!

EDIT var/log/httpd/error.log doesn't exist, so checking it won't help.


Solution

  • Did you install WordPress on your EC2 instance?

    If you have not, find your User Data in your EC2 instance settings and add the following:

    #!/bin/bash
    yum -y update
    yum install httpd php php-mysql -y
    cd /var/www/html
    echo "healthy" > healthy.html
    wget https://wordpress.org/wordpress-5.1.1.tar.gz
    tar -xzf wordpress-5.1.1.tar.gz
    cp -r wordpress/* /var/www/html
    rm -rf wordpress
    rm -rf wordpress-5.1.1.tar.gz
    chmod -R 755 wp-content
    chown -R apache:apache wp-content
    wget https://s3.amazonaws.com/bucketforwordpresslab-donotdelete/htaccess.txt
    mv htaccess.txt .htaccess
    chkconfig httpd on
    service httpd start

    I hope this works out well for you.