I've literally tried everything to get my web server broadcasted to the public but it's just not working. Every time I type my server IP in a browser like firefox it just gets stuck on "Waiting for ipaddress..." forever.
So here's what I did:
I completely reinstalled the operating system. I am using Centos 7 & Google Cloud
I installed httpd using the simple step by step guide as seen here: https://phoenixnap.com/kb/install-apache-on-centos-7
- I verified that the server is listening on port 80 with the command:
netstat -anp | grep httpd.
sh-4.2# netstat -anp | grep httpd tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 18025/httpd unix 3 [ ] STREAM CONNECTED 23993 18025/httpd
At first it was listening on tcp6 so I typed in the command nano /etc/httpd/conf/httpd.conf and changed "Listen 80" to "Listen 0.0.0.0:80" I still can't connect to my web server after restarting it.
I tried configuring virtual hosts by following the guide here: https://support.rackspace.com/how-to/set-up-virtual-hosts-on-centos/
I am not running IPtables.. I had no problems opening up port 80 in firewalld with the commands
sudo firewall-cmd --add-service=http --permanent sudo firewall-cmd --add-service=https --permanent sudo firewall-cmd ––reload
I also tried
sudo firewall-cmd ––permanent ––add-port=80/tcp sudo firewall-cmd ––permanent ––add-port=443/tcp sudo firewall-cmd ––reload
I then typed sudo firewall-cmd --list-all and saw that services http and https were listed
I still couldn't get a web page when I type the server ip in my browser so I completely disabled selinux and firewalld. It's still not working.
I installed IP tables and opened the necessary ports:
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT -A INPUT -i eth0 -p tcp -m tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT -A INPUT -j REJECT --reject-with icmp-host-prohibited -A FORWARD -j REJECT --reject-with icmp-host-prohibited
In the VPC Network -> Firewall Rules tab in Google Cloud you can clearly see that http is open for all ip ranges
default-allow-http Ingress http-server IP ranges: 0.0.0.0/0 tcp:80 Allow 1000 default
I used a curl command in the SSH console to test the website curl -I http://localhost
HTTP/1.1 200 OK Date: Sun, 22 Dec 2019 15:19:18 GMT Server: Apache/2.4.6 (CentOS) Last-Modified: Sun, 22 Dec 2019 14:54:44 GMT ETag: "5-59a4c176b0e2b" Accept-Ranges: bytes Content-Length: 5 Content-Type: text/html; charset=UTF-8
And it responded with 200 OK.. Meaning everything was configured correctly. I opened all the ports and still cannot get a page to display when I type the server IP in my firefox browser. I don't understand.... What am I doing wrong?
EDIT: Here is the error log
[Sun Dec 22 16:11:14.246082 2019] [suexec:notice] [pid 1244] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec) [Sun Dec 22 16:11:14.262897 2019] [lbmethod_heartbeat:notice] [pid 1244] AH02282: No slotmem from mod_heartmonitor [Sun Dec 22 16:11:14.262979 2019] [ssl:warn] [pid 1244] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache] [Sun Dec 22 16:11:14.270177 2019] [mpm_prefork:notice] [pid 1244] AH00163: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips configured -- resuming normal operations [Sun Dec 22 16:11:14.270214 2019] [core:notice] [pid 1244] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'