Skip to content

Instantly share code, notes, and snippets.

@sanket4373
Created November 15, 2019 22:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sanket4373/5d7d86ca015499ab92581337411614ec to your computer and use it in GitHub Desktop.
Save sanket4373/5d7d86ca015499ab92581337411614ec to your computer and use it in GitHub Desktop.
vm instance on google cloud compute instance
  1. Create a compute instance in one of your favorite cloud provider. I am going with gcloud example here
gcloud compute zones list
gcloud config set compute/zone <zone>
  1. Using gcloud shell Use whatever shell/terminal instance the cloud provider provides to interact with the compute instance or download cloudproviders SDK and execute commands from your local terminal to interact with it.

  2. Create a Ubuntu VM instance

gcloud compute instances create ubuntu \
--image-project ubuntu-os-cloud \
--image ubuntu-1604-xenial-v20160420c 
  1. Cloud shell - log into the VM instance
gcloud compute ssh ubuntu
sudo apt-get update
  1. Install nginx and verify that it's running
sudo apt-get install nginx
nginx -v 
sudo systemctl start nginx
sudo systemctl status nginx
  1. Run curl to verify
curl http://127.0.0.1

<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
  • It is really difficult to manager 2 different version of Nginx in a VM.

  • Most OSs allows us to run only one version at a time

  • We have to deal with this conf file etc/init/nginx.conf and we have consider that both versions are running on different ports.

  • All in all it is a cumbersome process

  • That's when container technology such as Docker comes in handy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment