Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I am new to using Google Cloud Platform and am trying to host a very simple static site. I have followed Google's tutorial for running a basic apache webserver exactly and yet, when I click on the external IP of my site, I am taken to a page that says "This site can't be reached. <my site's IP address> unexpectedly closed the connection ERR_CONNECTION_CLOSED .

Since creating the VM, I have run the following commands:

  • sudo apt-get update && sudo apt-get install apache2 -y
  • echo '<!doctype html><html><body><h1>Hello World!</h1></body></html>' | sudo tee /var/www/html/index.html
  • I also ran ping <site IP address> and saw lines of the form

    PING <IP address> 56(84) bytes of data.

    64 bytes from <IP address>: icmp_seq=1 ttl=76 time=0.746 ms

    I have ensured that the Firewall settings on my VM are set to allow both HTTP and HTTPS traffic.

    Why can I not see the simple Hello World page that should be hosted at my site? Do I need to manually start apache? I have tried to and not had any success.

    (My VM has Debian 8 as the Boot Image)

    UPDATE

    At the request of a user below, I ran sudo service apache2 status but got the response below:

    apache2.service - LSB: Apache2 web server Loaded: loaded (/etc/init.d/apache2) Drop-In: /lib/systemd/system/apache2.service.d └─forking.conf Active: active (running) since Mon 2017-01-23 01:27:44 UTC; 11h ago CGroup: /system.slice/apache2.service ├─2570 /usr/sbin/apache2 -k start ├─2573 /usr/sbin/apache2 -k start └─2574 /usr/sbin/apache2 -k start

    Running sudo service apache2 start did not seem to do anything.

    Yes, I stated that in the original post. I have added an update about what happened when I ran the commands you suggested. Mitchell Griest Jan 23, 2017 at 13:22

    Can you telnet to port 80 of your server ?. Try the following command:

    telnet your-server-ip 80
    

    If the above command does not work, then most likely the firewall is blocking port 80. Do you have a second firewall running on your server, such as iptables?.

    You need to enable SSL for apache.

    (the important bit is making a syslink in the sites-enabled folder of the ssl config file in the site-available folder) that will get it running but you'll need to tinker with the ssl key/cert stuff (check out certbot)

    here is a guide: https://hallard.me/enable-ssl-for-apache-server-in-5-minutes/

    To those facing this same issue, by default google tries to access URL/IP on HTTPS. But since SSL is not installed, it will not be able to access it. You have two options, 1) Install SSL on the root IP or remove the 's' in the https://xxxxxx address.

    https://xxxipORwebAddress
    
    http://xxxipORwebAddress
    

    I hope it helps

    Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.