Hi Folks. This article showcases how quickly one can setup NGINX server on Google Compute Engine.
A. Google Cloud Account. You can create one here.
1. Create Compute Engine Instance i.e. Virtual Machine
2. Deploy web server on VM
1. Create Compute Engine Instance i.e. Virtual Machine:
- In the GCP Console, top left of the screen, select Navigation menu > Compute Engine > VM Instances.
- To create a new instance, click Create. The few important parameters are
- Name: give the name of your choice for the instance e.g. ap-gcp-instance
- Region: Its a geographical location where you host/run your resources. In most cases select the region closest to your users. e.g asia-south1. The region is collection of zones.
- Zone: Each region as independent collection of zones. e.g. asia-south1-a
- Machine Type: select the machine type as per your application need. It can be standard, highmem or highcpu or memory optimized. e.g. 1 vCPU
- Boot disk: Its nothing but the OS for your VM. it can be ubuntu, debian, redhat or windows. e.g. Ubuntu 18.10
- Firewall: Tick the ‘Allow HTTP traffic‘ checkbox. This will create a firewall rule to allow HTTP traffic on port 80.
- Click Create. Instance will get created within a minute.
2. Deploy NGINX on VM Instance:
- Look out the external IP and try to access it e.g. http://22.214.171.124. You wont get anything loaded in browser because we haven’t setup any webserver yet.
- lets SSH the to virtual machine. Click on the SSH on right hand side. It will launch a SSH client integrated in browser. (My favourite black terminal window)
- One done, get the root access using command
sudo su –
4. as root user now, update OS first
5. Next install the NGINX on VM
apt-get install nginx -y
6. Check the nginx is running on server using below command
ps auxw | grep nginx
7. All Done. Lets browse the external ip now e.g. http://126.96.36.199/ You could see the default webpage showing message Welcome to nginx!
Suggestions and feedback are welcome !!!