about summary refs log tree commit diff stats
path: root/tools/nginx.html
diff options
context:
space:
mode:
Diffstat (limited to 'tools/nginx.html')
-rw-r--r--tools/nginx.html20
1 files changed, 10 insertions, 10 deletions
diff --git a/tools/nginx.html b/tools/nginx.html
index d64356d..2bddaf3 100644
--- a/tools/nginx.html
+++ b/tools/nginx.html
@@ -51,7 +51,7 @@
         #ACME challenge
         location ^~ /.well-known {
               allow all;
-              alias /srv/www/c9-pmwiki/pub/cert/.well-known/;
+              alias /srv/www/machine-pmwiki/pub/cert/.well-known/;
               default_type "text/plain";
               try_files $uri =404;
         }
@@ -60,11 +60,11 @@
         <p>First run dryrun to test if everything is ok;</p>
 
         <pre>
-        # certbot certonly --dry-run --email user@mail.org --webroot -w /srv/www/c9-pmwiki/pub/cert/-d example.sub.domain
+        # certbot certonly --dry-run --email user@mail.org --webroot -w /srv/www/machine-pmwiki/pub/cert/-d machine.example.org
         </pre>
 
         <pre>
-        # certbot certonly --email user@mail.org --webroot -w /srv/www/c9-pmwiki/pub/cert/-d example.sub.domain
+        # certbot certonly --email user@mail.org --webroot -w /srv/www/machine-pmwiki/pub/cert/-d machine.example.org
         </pre>
 
         <h3 id="mancert">2.2. Self certificate</h2>
@@ -103,7 +103,7 @@
         Locality Name (eg, city) []:
         Organization Name (eg, company) [Internet Widgits Pty Ltd]:
         Organizational Unit Name (eg, section) []:
-        Common Name (e.g. server FQDN or YOUR name) []:core.privat-network.net
+        Common Name (e.g. server FQDN or YOUR name) []:machine.example.org
         Email Address []:
 
         Please enter the following 'extra' attributes
@@ -142,7 +142,7 @@
         </pre>
 
         Signature ok
-        subject=/C=PT/ST=Some-State/O=Internet Widgits Pty Ltd/CN=core.privat-network.net
+        subject=/C=PT/ST=Some-State/O=Internet Widgits Pty Ltd/CN=machine.example.org
         Getting Private key
         Enter pass phrase for /etc/ssl/keys/nginx.key:
         </pre>
@@ -282,19 +282,19 @@
 
         <p> This server is configured in a way that
         root serves pmwiki and /tasks serves flyspray. In order to
-        flyspray to link correctly change index is needed. Create /etc/nginx/sites-enabled/example.sub.domain.conf;</p>
+        flyspray to link correctly change index is needed. Create /etc/nginx/sites-enabled/machine.example.org.conf;</p>
 
         <pre>
         server {
 
             listen 443 ssl;
             listen 80;
-            server_name example.sub.domain;
+            server_name machine.example.org;
 
             #  listen [::]:443 ssl http2;
-            ssl_certificate /etc/letsencrypt/live/example.sub.domain/fullchain.pem;
-            ssl_certificate_key /etc/letsencrypt/live/example.sub.domain/privkey.pem;
-            ssl_trusted_certificate /etc/letsencrypt/live/example.sub.domain/chain.pem;
+            ssl_certificate /etc/letsencrypt/live/machine.example.org/fullchain.pem;
+            ssl_certificate_key /etc/letsencrypt/live/machine.example.org/privkey.pem;
+            ssl_trusted_certificate /etc/letsencrypt/live/machine.example.org/chain.pem;
 
             ssl_session_timeout 1d;
             ssl_session_cache shared:SSL:50m;
; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
##[
internal API for now, API subject to change
]##

# xxx move other git utilities here; candidate for stdlib.

import std/[os, osproc, strutils, tempfiles]

const commitHead* = "HEAD"

template retryCall*(maxRetry = 3, backoffDuration = 1.0, call: untyped): bool =
  ## Retry `call` up to `maxRetry` times with exponential backoff and initial
  ## duraton of `backoffDuration` seconds.
  ## This is in particular useful for network commands that can fail.
  runnableExamples:
    doAssert not retryCall(maxRetry = 2, backoffDuration = 0.1, false)
    var i = 0
    doAssert: retryCall(maxRetry = 3, backoffDuration = 0.1, (i.inc; i >= 3))
    doAssert retryCall(call = true)
  var result = false
  var t = backoffDuration
  for i in 0..<maxRetry:
    if call:
      result = true
      break
    if i == maxRetry - 1: break
    sleep(int(t * 1000))
    t = t * 2 # exponential backoff
  result

proc isGitRepo*(dir: string): bool =
  ## This command is used to get the relative path to the root of the repository.
  ## Using this, we can verify whether a folder is a git repository by checking
  ## whether the command success and if the output is empty.
  let (output, status) = execCmdEx("git rev-parse --show-cdup", workingDir = dir)
  # On Windows there will be a trailing newline on success, remove it.
  # The value of a successful call typically won't have a whitespace (it's
  # usually a series of ../), so we know that it's safe to unconditionally
  # remove trailing whitespaces from the result.
  result = status == 0 and output.strip() == ""

proc diffFiles*(path1, path2: string): tuple[output: string, same: bool] =
  ## Returns a human readable diff of files `path1`, `path2`, the exact form of
  ## which is implementation defined.
  # This could be customized, e.g. non-git diff with `diff -uNdr`, or with
  # git diff options (e.g. --color-moved, --word-diff).
  # in general, `git diff` has more options than `diff`.
  var status = 0
  (result.output, status) = execCmdEx("git diff --no-index $1 $2" % [path1.quoteShell, path2.quoteShell])
  doAssert (status == 0) or (status == 1)
  result.same = status == 0

proc diffStrings*(a, b: string): tuple[output: string, same: bool] =
  ## Returns a human readable diff of `a`, `b`, the exact form of which is
  ## implementation defined.
  ## See also `experimental.diff`.
  runnableExamples:
    let a = "ok1\nok2\nok3\n"
    let b = "ok1\nok2 alt\nok3\nok4\n"
    let (c, same) = diffStrings(a, b)
    doAssert not same
    let (c2, same2) = diffStrings(a, a)
    doAssert same2
  runnableExamples("-r:off"):
    let a = "ok1\nok2\nok3\n"
    let b = "ok1\nok2 alt\nok3\nok4\n"
    echo diffStrings(a, b).output

  template tmpFileImpl(prefix, str): auto =
    let path = genTempPath(prefix, "")
    writeFile(path, str)
    path
  let patha = tmpFileImpl("diffStrings_a_", a)
  let pathb = tmpFileImpl("diffStrings_b_", b)
  defer:
    removeFile(patha)
    removeFile(pathb)
  result = diffFiles(patha, pathb)