apt-get update && apt-get upgrade -y
- Setting up hostname, skip if done with installation
pico /etc/hosts
| local appPrefix = ARGV[1] | |
| local userId = KEYS[1] | |
| if not appPrefix then | |
| appPrefix = "trak" | |
| end | |
| if not userId then | |
| return "error: userId/keys[1] is required" | |
| end |
| local utcDate = KEYS[1] -- because redis does not have os.time, we require a utc date expecting yyyy-mm-dd hh-mm-ss | |
| local userId = KEYS[2] -- a username/email/unique identifier | |
| local eventName = KEYS[3] -- event name to track | |
| local siteId = KEYS[4] -- site id | |
| local appPrefix = ARGV[1] | |
| if not utcDate then | |
| return "error: utcDate/keys[1] is required" | |
| end |
| local ACCOUNT='youraccount' | |
| local KEY='youkey' | |
| local azure = require('niiknow/webslib/azure.lua') | |
| -- PrimaryKey is db like in redis, if not provided set to -default | |
| local pKey = request.query['db'] or '-default' | |
| -- RowKey is the actual key | |
| local rKey = request.query['key'] |
| # https://www.scalescale.com/tips/nginx/nginx-proxy-cache-explained-2/ | |
| proxy_cache_path /var/lib/nginx/cache levels=1:2 keys_zone=my_diskcached:10m max_size=5g inactive=45m use_temp_path=off; | |
| server { | |
| listen 80; | |
| set $cache_uri $uri; | |
| server_name example.com; | |
| location ~ /purge(/.*) { | |
| proxy_cache_purge my_diskcached acme.mycachedefault$uri$is_args$args; |
| #!/bin/bash | |
| if [ "$(id -u)" != "0" ]; then | |
| echo "This script must be run as root!" 1>&2 | |
| exit 1 | |
| fi | |
| export DEBIAN_FRONTEND=noninteractive | |
| add-apt-repository universe | |
| apt-get update && apt-get upgrade -y | |
| apt-get -y install ntpdate fail2ban apt-transport-https ca-certificates software-properties-common |
| <IfModule mod_rewrite.c> | |
| <IfModule mod_negotiation.c> | |
| Options -MultiViews | |
| </IfModule> | |
| # this allow for anonymous access | |
| <If "req('X-DreamFactory-Api-Key') == '' && req('X-DreamFactory-Session-Token') == ''"> | |
| RequestHeader set X-DreamFactory-Api-Key your-app-token | |
| </If> |
| <? | |
| $path = addslashes($_GET["file"]); | |
| $ip = addslashes($_SERVER['REMOTE_ADDR']); | |
| if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { | |
| $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; | |
| } | |
| $dl = false; |
| <? | |
| $counterBaseDir = './counter/'; | |
| $files = glob($counterBaseDir . '*.txt') | |
| $now = date("YmdHi"); | |
| foreach ($files as $file) { | |
| $fileParts = explode($file, "_"); | |
| $fileDate = $fileParts[0]; | |
| $tenant = $fileParts[1]; |
| server { | |
| listen 80 default_server; | |
| listen [::]:80 default_server; | |
| #NGINX_INSERT0; | |
| #NGINX_INSERT1; | |
| if ($time_iso8601 ~ "^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})") { | |
| set $year $1; | |
| set $month $2; |