Troubleshooting Launch of Apache on GCP Virtual Machine | Scribe

    Troubleshooting Launch of Apache on GCP Virtual Machine

    • Hafeez Baig |
    • 16 steps |
    • 2 minutes
    information ordinal icon
    Refer to this guide to learn how to create a Virtua Machine in GCP\ <https://scribehow.com/shared/Creating_your_first_Virtual_Machine_in_GCP__dF2VjMksT5en6PowYws7lQ> Refer to this guide to learn how to Install HTTP WebServer on a Virtual Machine in GCP<https://scribehow.com/shared/Installing_HTTP_Webserver_on_Google_Compute_Engine_Virtual_Machine__RCjtAN8xTAm6_ZvYcUD8vQ>
    1
    Sign in into the **Google Cloud Platform**
    2
    Type "**Compute Engine**" in the search bar and click on the **Compute Engine** option
    information ordinal icon
    **What is a Compute Engine?** Google Compute Engine (GCE) is an Infrastructure-as-a-Service (IaaS) offering from Google Cloud Platform (GCP) that allows users to run virtual machines (VMs) on Google's infrastructure. It provides scalable and flexible computing resources, high-performance persistent storage, advanced networking capabilities, and integration with other GCP services, making it suitable for a variety of workloads including web hosting, data processing, and high-performance computing.
    3
    On the **VM instances** page, scroll to the **External IP** and click on the copy widget
    4
    Open the new tab in browser and paste the copied **External IP**
    5
    **Hello World** and its host details will be displayed
    alert ordinal icon
    In case you can't see the "Hello World " and host details even after using the correct **external IP**, follow the steps below.
    6
    On the **VM instances** page, scroll to the **Connect** section and click on the **SSH** button
    7
    **SSH** wizard will open in a new window **Note:** Connecting to the VM instance via SSH will take some time.
    8
    **Authorize** wizard will open, click on the **Authorize** button
    9
    You have successfully connected to the VM instance via **SSH**, type the command **ls /var/www/html**
    information ordinal icon
    **What is [[ls /var/www/html ]]command?**\ \ The `ls /var/www/html` command lists the contents of the `/var/www/html` directory. This directory is typically the default root directory for web content on an Apache web server, so the command shows the files and subdirectories that are accessible via the web server.
    10
    The command results **index.html**
    11
    Type the command [[ls /var/www/html/index.html]]
    information ordinal icon
    **What is [[ls /var/www/html/index.html ]]command?**\ \ The `ls /var/www/html/index.html` command checks if the `index.html` file exists in the `/var/www/html` directory and displays its details, such as file permissions, owner, size, and modification date. If the file exists, its information will be listed; if it does not exist, an error message will be displayed.
    12
    The command results **Hello World from my-instance-template-with-startup-script-with-image-2 10.128.0.5** **Note:** It displays the content of the `index.html` file, indicating that the file is correct.
    13
    Type the command [[sudo su]]
    information ordinal icon
    **What is [[sudo su]] command ?**\ \ The `sudo su` command in Unix-like operating systems allows a user to switch to the root user (superuser) account. `sudo` grants root-level privileges to the subsequent command, while `su` switches to the root user by default. When combined, `sudo su` provides root access, enabling the user to perform administrative tasks without logging out of their current session.
    14
    Type the command [[service apache2 start]] **Note**: Since the `index.html` file is correct, we need to check if the Apache server is running.