Nginx Cheat Sheet



  • Setup notes

Helpful Commands

Check if a parity operation is in-progress

Check the status of a parity operation. Wait for % complete is mdResyncPos/mdResyncSize. Oqo laptops & desktops driver download.

  • https://www.youtube.com/channel/UCZDfnUn74N0WeAPvMqTOrtA/videos - Very good tutorials on just about every unraid topic.
  1. A quick reference to common server configurations from serving static files to using in congruency with Node.js applications. Each configuration below is written with minimum requirements for their described function. Please know that real world applications will most likely use a combination of these settings.
  2. Nginx Cheat Sheet This cheat sheet includes symbol syntax and methods to help you using NGINX. NGINX is open-source software for web serving, reverse proxying, caching, load balancing, media streaming, and more. It started out as a web server designed for maximum performance and stability.

Nginx configuration cheatsheet with examples for advanced usage - VirtuBox/advanced-nginx-cheatsheet.

Setup Community Applications

This will allow you to search and install applications (plugins and docker containers).

  • Click the Plugins tab
  • Click the Install a plugin tab
  • Add this URL: https://raw.githubusercontent.com/Squidly271/community.applications/master/plugins/community.applications.plg
  • Click install

VPN Setup

VPN Certificates

Create a share named vpn. Make it private so only you can read it.Next, download your VPN certs from your VPN provider's website and do the following:

  • Copy the following into that share: ca.crt, .crt, .key, ta.key, and one of the ovpn file you want to use
  • Rename the ovpn file to vpn.conf
  • Edit the vpn.conf file and put the full path where it references the certs. /vpn/ca.crt, etc..

VPN Container

Nginx Security Cheat Sheet

  • Click the docker tab
  • Click Add container
  • Name: vpn
  • Repository: dperson/openvpn-client
  • Privileged: On
  • Path: /mnt/user/vpn/ -> Container Path: /vpn
  • Extra Parameters: --cap-add=NET_ADMIN --dns=8.8.8.8 --sysctl net.ipv6.conf.all.disable_ipv6=0
  • Container Device: /dev/net/tun
  • Variable:
    • Name: FIREWALL
    • Value: true
  • Click Apply

Go to the docker tab. Look at the last column on the right for the VPN container, look at the logs, make sure things are OK. Should say 'Initialization Sequence Completed'. May take 5 minutes or more to complete.

Deluge

Cheat

First setup Deluge.

  • Go to 'Apps' tab and search for 'Deluge' and add it. I use captinsano/deluge
  • Name: Deluge
  • Extra Parameters: --net='container:vpn'
  • Network Type: None
  • Privileged: Off
  • Add your paths for the media

NOTE:Prior to Unraid 6.8 you'd add --net='container:vpn' as an 'extra parameter'. With Unraid 6.8, that broke. For 6.8, as of now until there's a better solution, open the console and type the following

Now (You'll probably need to reload the UI to get this to show up) in the Network Type drop down, select the network you just created, which is container:vpn

The above configures Deluge but you won't be able to reach the web UI since the network type is set to 'none'. To reach it, we'll create a proxy with nginx, see the next section

nginx

Go to 'Apps' tab and search for 'nginx' and add it. I use linuxserver/nginx. Enter these settings:

  • Name: nginx
  • Repository: dperson/nginx
  • Extra Parameters: --link vpn:deluge -p 8112:8112
  • Network Type: Bridge
  • Host Port 1: 8080
  • Host Port 2: 8443
  • AppData Config Path: /mnt/user/appdata/nginx

In the /mnt/user/appdata/nginx, edit the nginx configuration file as needed. Here's mine, which includes a proxy_pass for deluge.

Ipad not receiving all messages

Now you can reach the Deluge web UI by going to http://:8112/

Home Assistant

This will get Home Assistant running with a Z-Wave USB stick.

  • Go to apps, install home-assistant
  • Network type: Host
  • Extra Parameters: select device
    • Name: ttyACM0
    • Value: /dev/ttyACM0
  • Privileged: On
  • Start the container.

Now edit the file /mnt/user/appdata/home-assistant/configuration.yaml and add the following two lines and then restart Home Assistant.

Jackett

  • Got to apps and search for linuxserver/jackett
  • Name: Jackett
  • Network Type: Bridge
  • Privileged: off
  • Host Port 1: 9117
  • Host Path 2: /mnt/user/media/downloads/

Plex Media Server

  • Go to apps and search for PlexMediaServer. I used the one from limetech/plex
  • Name PlexMediaServer
  • Network Type: Host
  • Privileged: on
  • Add a container path variable: /mnt/user/media/

Tip: You might want to hook up PlexTraktSync to sync your watched state to Trakt.

Tautulli

  • Go to apps and search for tautulli. I use the one from linuxserver/tautulli
  • Name: Tautulli
  • Network Type: Bridge
  • Host Port 1: 8181
  • Host Path 1: /logs

Sonarr

  • Go to apps and search for sonarr. I use the one from linuxserver/sonarr
  • Name: Sonarr
  • Network Type: Bridge
  • Privileged: Off
  • Host Port 1: 8989

Radarr

  • Go to apps and search for radarr. I use the one from linuxserver/radarr
  • Name: Radarr
  • Network Type: Bridge
  • Privileged: Off
  • Host Port 1: 7878

Nginx docs are here but good luck finding anything thereif you don’t already where it is.

Redirect non-SSL to SSL¶

From https://serverfault.com/questions/250476/how-to-force-or-redirect-to-ssl-in-nginx:

Most useful variables¶

$host

in this order of precedence: host name from the request line, or host name from the “Host” request header field, or the server name matching a request

$http_host

Value of the “Host:” header in the request (same as all $http_<headername> variables)

$https

“on” if connection operates in SSL mode, or an empty string otherwise

$request_method

request method, usually “GET” or “POST”

$request_uri

full original request URI (with arguments)

$scheme

request scheme, e.g. “http” or “https”

$server_name

name of the server which accepted a request

$server_port

port of the server which accepted a request

Variables in configuration files¶

See above for “variables” that get set automatically for each request(and that we cannot modify). Option others driver download.

The ability to set variables at runtime and control logic flow based on themis part of the rewrite moduleand not a general feature of nginx.

You can set avariable:

“The value can contain text, variables, and their combination.” – but I have not yet foundthe documentation on how these can be “combined”.

Then use if etc.:

Nginx security cheat sheet

Conditions can include:

Examples:

Nginx Ssl Ciphers Cheat Sheet

Warning

You CANNOT put any directive you want inside the if,only rewrite directives like set, rewrite, return, etc.

Warning

Nginx Cheat Sheet Pdf

The values of variables you set this way can ONLY be used in if conditions,and maybe rewrite directives; don’t try to use them elsewhere.