Skip to content
kimschles edited this page Sep 7, 2018 · 1 revision
  • nginx is a webserver, proxy and load balancer
  • the most well-known nginx project is the open source version
    • also available is nginx +, and other enterprise offerings
  • nginx was developed by Igor Sysoev to solve the C10K problem (concurrently handling 10,000 connections)

Install nginx on an Ubuntu16 Machine

Update software already on the server

  • sudo apt-get update && sudo apt-get upgrade -y

Install nginx

  1. Download the signing key
  • curl -o nginx_signing.key http://nginx.org/keys/nginx_signing.key
  1. Save the key in your apt-key
  • sudo apt-key add nginx_signing.key
  1. Update your sources list to include the latest stable version of nginx
  • sudo vim /etc/apt/sources.list
  1. Append these lines:

## Add official NGINX repository deb http://nginx.org/packages/ubuntu/ xenial nginx deb-src http://nginx.org/packages/ubuntu/ xenial nginx

  1. Install nginx:
  • sudo apt-get update && sudo apt-get install -y nginx

Start and Enable nginx

  • sudo systemctl start nginx
  • sudo systemctl enable nginx

Configuration

  • The nginx configuration files live in /etc/nginx directory
  • There are directives and contexts in the nginx.config file
    • Directives are key:value pairs separated with a space
      • Ex: user nginx;
    • Contexts are named and the values are between curly braces
      • Ex:
      events {
          worker_connections  1024;
      }
      
  • Variables start with a dollar sign
    • Ex: $request
  • Comments start with a hash and no space
    • #Thisisacomment
Clone this wiki locally