Search code examples
google-cloud-platformgoogle-compute-engine

How to install Apache server in GCE VM instance?


I tried to install apache server in GCE VM by these commands:

sudo docker pull httpd
sudo docker run -d --name apache-server -p 86:80 httpd                          
sudo docker container start apache-server

But when I try to hit the port http://34.138.232.98:86/, I get the following:

Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.

Thank you for using nginx.

I installed the Apache but getting NGINX, not able to understand what exactly happened here.


Solution

  • Looks like there's another http server running in your container that blocks the port.

    Try creating a new VM and run commands sudo docker pull httpd & sudo docker run -d --name apache-server -p 86:80 httpd only.

    docker run starts the container so you don't need to docker start it.

    Try fresh VM (ideally Container Optimised OS). You can always install the Apache directly on the VM if that's the only thing that you need to run on it with sudo apt install apache2 -y and allow http traffic in your VM's firewall with sudo ufw allow 'WWW'.

    Make sure also that your GPS's firewall allows traffic in & out.