Initial Push (v0.0.3)
This commit is contained in:
38
conf/deploy.sh
Normal file
38
conf/deploy.sh
Normal file
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
|
||||
ROOTIN="/data/in"
|
||||
ROOTOUT="/data/out"
|
||||
|
||||
echo "Running UglifyJS on /data/in folder"
|
||||
uglifyjs-folder "$ROOTIN" -x ".js" -eo "$ROOTOUT"
|
||||
|
||||
echo "Running UglifyCSS"
|
||||
CSSIN="/data/in/styles/"
|
||||
CSSOUT="/data/out/styles"
|
||||
|
||||
cd $CSSIN
|
||||
echo "Changed directory"
|
||||
pwd
|
||||
for f in *
|
||||
do
|
||||
if [ -f "$f" ]; then
|
||||
uglifycss "$f" --output "$f";
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Moving 'styles' to 'out'"
|
||||
cp -r /data/in/styles /data/out/styles
|
||||
|
||||
echo "Running html-minifier-terser on /folder"
|
||||
HTMLIN="/data/in/"
|
||||
HTMLOUT="/data/out"
|
||||
html-minifier-terser --collapse-whitespace --remove-comments --file-ext html --input-dir /data/in/ --output-dir /data/out/
|
||||
|
||||
echo "Moving JSON Manifest file from root to output"
|
||||
cat /data/in/manifest.json | jq -c > /data/out/manifest.json
|
||||
|
||||
echo "Moving images folder from in/ to out/"
|
||||
cp -r /data/in/images /data/out/images
|
||||
|
||||
echo "Running GZIP & Brotli on all HTML, JS, CSS, JSON & SVG files"
|
||||
find /data/out -type f -name \*.html -or -name \*.js -or -name \*.css -or -name \*.json -or -name \*.svg -or -name \*.ttf | while read file; do gzip -k -9 $file; brotli -k -q 11 $file; done
|
||||
60
conf/nginx.conf
Normal file
60
conf/nginx.conf
Normal file
@@ -0,0 +1,60 @@
|
||||
user nginx;
|
||||
worker_processes 1;
|
||||
|
||||
error_log /var/log/nginx/error.log notice;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
sendfile on;
|
||||
keepalive_timeout 65;
|
||||
|
||||
proxy_cache_path /var/cache/nginx keys_zone=owl_cache:20m inactive=24h;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
proxy_cache owl_cache;
|
||||
|
||||
add_header Content-Security-Policy "default-src 'self'";
|
||||
|
||||
location / {
|
||||
root /site-static/;
|
||||
index index.html;
|
||||
gzip_static on;
|
||||
brotli_static on;
|
||||
error_page 404 /404.html;
|
||||
expires 3600;
|
||||
add_header Cache-Control "public, no-transform";
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://localhost:8460;
|
||||
proxy_cache_key $scheme://$host$uri$is_args$query_string;
|
||||
proxy_ignore_headers Cache-Control;
|
||||
proxy_cache_valid 200 2m; # Evaluate whether 2m or 1m is more appropriate
|
||||
expires 2m;
|
||||
add_header Cache-Control "private, no-transform";
|
||||
}
|
||||
|
||||
location /api/v1/list/ {
|
||||
proxy_pass http://localhost:8460;
|
||||
proxy_cache_key $scheme://$host$uri$is_args$query_string;
|
||||
proxy_ignore_headers Cache-Control;
|
||||
proxy_cache_valid 200 10080m;
|
||||
expires 3d;
|
||||
add_header Cache-Control "public, no-transform";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user