I have a web server that I am running. I am attempting to load the test page by visiting the public DNS of the EC2 Instance. I keep getting the error that the instance "took too long to respond."
My security groups allow listening on ports 22 and 80.
When I add the port 443 the error changes to "refused to connect".
I ensured by running the service httpd status
that the web service was active:
[ec2-user@ip-redacted ~]$ service httpd status
Redirecting to /bin/systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; preset: disabled)
Drop-In: /usr/lib/systemd/system/httpd.service.d
└─php-fpm.conf
Active: active (running) since Sun 2023-06-18 05:05:28 UTC; 41min ago
Docs: man:httpd.service(8)
Main PID: 30282 (httpd)
Status: "Total requests: 16; Idle/Busy workers 100/0;Requests/sec: 0.00645; Bytes served/sec: 3 B/sec"
Tasks: 177 (limit: 1114)
Memory: 18.3M
CPU: 1.202s
CGroup: /system.slice/httpd.service
├─30282 /usr/sbin/httpd -DFOREGROUND
├─30343 /usr/sbin/httpd -DFOREGROUND
├─30347 /usr/sbin/httpd -DFOREGROUND
├─30348 /usr/sbin/httpd -DFOREGROUND
└─30350 /usr/sbin/httpd -DFOREGROUND
Jun 18 05:05:28 ip-redacted.ec2.internal systemd[1]: Starting httpd.service - The Apache HTTP Server...
Jun 18 05:05:28 ip-redacted.ec2.internal systemd[1]: Started httpd.service - The Apache HTTP Server.
Jun 18 05:05:28 ip-redacted.ec2.internal httpd[30282]: Server configured, listening on: port 80
I ran curl -v http://localhost
and received:
[ec2-user@ip-redacted ~]$ curl -v http://localhost
* Trying 127.0.0.1:80...
* Connected to localhost (127.0.0.1) port 80 (#0)
> GET / HTTP/1.1
> Host: localhost
> User-Agent: curl/8.0.1
> Accept: */*
>
< HTTP/1.1 403 Forbidden
< Date: Sun, 18 Jun 2023 05:38:49 GMT
< Server: Apache/2.4.56 (Amazon Linux)
< Last-Modified: Mon, 11 Jun 2007 18:53:14 GMT
< ETag: "2d-432a5e4a73a80"
< Accept-Ranges: bytes
< Content-Length: 45
< Content-Type: text/html; charset=UTF-8
<
<html><body><h1>It works!</h1></body></html>
* Connection #0 to host localhost left intact
I'd like to have the test page pop up when I visit the public DNS.