Edit nginx.conf

  • sudo cp /etc/nginx/nginx.conf /etc/nginx/nginx-backup.conf
  • sudo vim /etc/nginx/nginx.conf
    • Delete everything below the events block (80dd).
  • Set up http basics.
http {
  
  # Enable websockets (needed for Shiny) -- I don't know if this part matters.
  map $http_upgrade  $connection_upgrade { 
    default upgrade; '' close; 
  }
  
  server { listen 80;
  
    # You can edit this file if you want a default page.
    root /usr/share/nginx/html;
    index index.html index.htm;
  
    # I think this was necessary to get it to work.
    # We'll do more with this in Chapter 13.
    server_name ec2-12-345-678-90.compute-1.amazonaws.com;
  }
}
  • sudo systemctl restart nginx
  • Test it at your “Public IPv4 DNS”.