Teaching Research and Publishings Speaking Engagements Professional Development About Me

Server Setup Documents

Configuring Nginx

We are going to Setup Nginx as a Proxy. Using the SSH command line from the Google Cloud let's configure Nginx:

  1. Open up the Nginx configuration file:

    sudo nano /etc/nginx/sites-available/default
  2. Change the server name in the configuration file to:

    server_name something.domain.com;
  3. Change the location definition to redirect requests to our index NodeJS application:

    location / {
      proxy_pass http://localhost:8080;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection 'upgrade';
      proxy_set_header Host $host;
      proxy_cache_bypass $http_upgrade;
  4. And finally restart Nginx to apply changes:

    sudo systemctl restart nginx

Now if you visit your subdomain you will see the Hello World! message from the index NodeJS application.