improve webroot conffile handling
This commit is contained in:
@@ -1,15 +0,0 @@
|
||||
# serve tar1090 directly at / the web server root
|
||||
alias.url += (
|
||||
"/data/" => "/run/dump1090-fa/",
|
||||
"/chunks/" => "/run/tar1090/",
|
||||
"/" => "/usr/local/share/tar1090/html/",
|
||||
)
|
||||
|
||||
$HTTP["url"] =~ "^/chunks/chunk_.*gz$" {
|
||||
setenv.add-response-header += (
|
||||
"Access-Control-Allow-Origin" => "*",
|
||||
"Cache-Control" => "must-revalidate",
|
||||
"Content-Encoding" => "gzip",
|
||||
"Content-Type" => "application/json",
|
||||
)
|
||||
}
|
||||
38
install.sh
38
install.sh
@@ -123,8 +123,8 @@ fi
|
||||
|
||||
|
||||
# copy over base files
|
||||
cp default install.sh uninstall.sh 99-tar1090-webroot.conf LICENSE README.md \
|
||||
95-tar1090-otherport.conf nginx_webroot.conf $ipath
|
||||
cp default install.sh uninstall.sh LICENSE README.md \
|
||||
95-tar1090-otherport.conf $ipath
|
||||
|
||||
|
||||
services=""
|
||||
@@ -145,8 +145,22 @@ do
|
||||
cp -n default /etc/default/$service
|
||||
sed -i -e 's/skyview978/skyaware978/' /etc/default/$service
|
||||
|
||||
sed -i.orig -e "s?SOURCE_DIR?$srcdir?g" -e "s?SERVICE?$service?g" -e "s?INSTANCE?$instance?g" -e "s?HTMLPATH?$html_path?g" 88-tar1090.conf
|
||||
sed -i.orig -e "s?SOURCE_DIR?$srcdir?g" -e "s?SERVICE?$service?g" -e "s?INSTANCE?$instance?g" -e "s?HTMLPATH?$html_path?g" nginx.conf
|
||||
if [[ "$instance" == "webroot" ]]
|
||||
then
|
||||
sed -i.orig -e "s?SOURCE_DIR?$srcdir?g" -e "s?SERVICE?$service?g" \
|
||||
-e "s?/INSTANCE??g" -e "s?HTMLPATH?$html_path?g" 88-tar1090.conf
|
||||
sed -i.orig -e "s?SOURCE_DIR?$srcdir?g" -e "s?SERVICE?$service?g" \
|
||||
-e "s?/INSTANCE??g" -e "s?HTMLPATH?$html_path?g" nginx.conf
|
||||
|
||||
else
|
||||
|
||||
sed -i.orig -e "s?SOURCE_DIR?$srcdir?g" -e "s?SERVICE?$service?g" \
|
||||
-e "s?INSTANCE?$instance?g" -e "s?HTMLPATH?$html_path?g" 88-tar1090.conf
|
||||
sed -i.orig -e "s?SOURCE_DIR?$srcdir?g" -e "s?SERVICE?$service?g" \
|
||||
-e "s?INSTANCE?$instance?g" -e "s?HTMLPATH?$html_path?g" nginx.conf
|
||||
|
||||
fi
|
||||
|
||||
sed -i.orig -e "s?SOURCE_DIR?$srcdir?g" -e "s?SERVICE?$service?g" tar1090.service
|
||||
|
||||
# keep some stuff around
|
||||
@@ -209,11 +223,19 @@ do
|
||||
if [[ $lighttpd == yes ]] && ! diff 88-tar1090.conf /etc/lighttpd/conf-enabled/88-$service.conf &>/dev/null
|
||||
then
|
||||
changed_lighttpd=yes
|
||||
cp 88-tar1090.conf /etc/lighttpd/conf-available/88-$service.conf
|
||||
if [ -f /etc/lighttpd/conf.d/69-skybup.conf ]; then
|
||||
ln -f -s /etc/lighttpd/conf-available/88-$service.conf /etc/lighttpd/conf-enabled/66-$service.conf
|
||||
if [ -f /etc/lighttpd/conf.d/69-skybup.conf ] && [[ "$instance" == "webroot" ]]; then
|
||||
true
|
||||
elif [[ "$instance" == "webroot" ]]
|
||||
then
|
||||
cp 88-tar1090.conf /etc/lighttpd/conf-available/99-$service.conf
|
||||
ln -f -s /etc/lighttpd/conf-available/99-$service.conf /etc/lighttpd/conf-enabled/99-$service.conf
|
||||
else
|
||||
ln -f -s /etc/lighttpd/conf-available/88-$service.conf /etc/lighttpd/conf-enabled/88-$service.conf
|
||||
cp 88-tar1090.conf /etc/lighttpd/conf-available/88-$service.conf
|
||||
if [ -f /etc/lighttpd/conf.d/69-skybup.conf ]; then
|
||||
ln -f -s /etc/lighttpd/conf-available/88-$service.conf /etc/lighttpd/conf-enabled/66-$service.conf
|
||||
else
|
||||
ln -f -s /etc/lighttpd/conf-available/88-$service.conf /etc/lighttpd/conf-enabled/88-$service.conf
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
24
nginx.conf
24
nginx.conf
@@ -5,15 +5,29 @@ location /INSTANCE/data/ {
|
||||
add_header Cache-Control "public, max-age=0";
|
||||
}
|
||||
location /INSTANCE/data/traces/ {
|
||||
add_header Cache-Control "public, max-age=10";
|
||||
add_header Content-Type "application/json";
|
||||
add_header Content-Encoding "gzip";
|
||||
location ~ trace_recent {
|
||||
add_header Cache-Control "public, max-age=10";
|
||||
add_header Content-Type "application/json";
|
||||
add_header Content-Encoding "gzip";
|
||||
}
|
||||
location ~ trace_full {
|
||||
add_header Cache-Control "public, max-age=60";
|
||||
add_header Content-Type "application/json";
|
||||
add_header Content-Encoding "gzip";
|
||||
}
|
||||
}
|
||||
location ~ globe_.*\.json$ {
|
||||
add_header Cache-Control "public, max-age=2";
|
||||
}
|
||||
}
|
||||
|
||||
location /INSTANCE/globe_history/ {
|
||||
alias /var/globe_history/;
|
||||
add_header Cache-Control "public, max-age=600";
|
||||
add_header Content-Type "application/json";
|
||||
add_header Content-Encoding "gzip";
|
||||
}
|
||||
|
||||
location /INSTANCE/chunks/ {
|
||||
alias /run/SERVICE/;
|
||||
location ~ chunk_.*\.gz$ {
|
||||
@@ -31,7 +45,7 @@ location /INSTANCE/chunks/ {
|
||||
}
|
||||
}
|
||||
|
||||
location /INSTANCE {
|
||||
location /INSTANCE/ {
|
||||
alias HTMLPATH/;
|
||||
try_files $uri $uri/ =404;
|
||||
location ~ db/.*\.json$ {
|
||||
@@ -44,7 +58,7 @@ location /INSTANCE {
|
||||
add_header Cache-Control "public, max-age=1209600";
|
||||
}
|
||||
location ~ config.js$ {
|
||||
add_header Cache-Control "must-revalidate";
|
||||
add_header Cache-Control "public, max-age=10";
|
||||
}
|
||||
location ~ .*\.js$ {
|
||||
add_header Cache-Control "public, max-age=1209600";
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
# nginx configuration for tar1090 for access via /
|
||||
location /data/ {
|
||||
alias /run/dump1090-fa/;
|
||||
location ~ aircraft\.json$ {
|
||||
add_header Cache-Control "public, max-age=0";
|
||||
}
|
||||
location /data/traces/ {
|
||||
add_header Cache-Control "public, max-age=10";
|
||||
add_header Content-Type "application/json";
|
||||
add_header Content-Encoding "gzip";
|
||||
}
|
||||
location ~ globe_.*\.json$ {
|
||||
add_header Cache-Control "public, max-age=2";
|
||||
}
|
||||
}
|
||||
|
||||
location /chunks/ {
|
||||
alias /run/tar1090/;
|
||||
location ~ chunk_.*\.gz$ {
|
||||
add_header Cache-Control "public, max-age=1209600";
|
||||
add_header Content-Type "application/json";
|
||||
add_header Content-Encoding "gzip";
|
||||
}
|
||||
location ~ current_.*\.gz$ {
|
||||
add_header Cache-Control "must-revalidate";
|
||||
add_header Content-Type "application/json";
|
||||
add_header Content-Encoding "gzip";
|
||||
}
|
||||
location ~ .*\.json$ {
|
||||
add_header Cache-Control "public, max-age=0";
|
||||
}
|
||||
}
|
||||
|
||||
location / {
|
||||
alias /usr/local/share/tar1090/html/;
|
||||
try_files $uri $uri/ =404;
|
||||
location ~ db/.*\.json$ {
|
||||
add_header Cache-Control "public, max-age=100000";
|
||||
}
|
||||
location ~ .*\.png$ {
|
||||
add_header Cache-Control "public, max-age=1209600";
|
||||
}
|
||||
location ~ .*\.gif$ {
|
||||
add_header Cache-Control "public, max-age=1209600";
|
||||
}
|
||||
location ~ config.js$ {
|
||||
add_header Cache-Control "must-revalidate";
|
||||
}
|
||||
location ~ .*\.js$ {
|
||||
add_header Cache-Control "public, max-age=1209600";
|
||||
}
|
||||
location ~ .*\.css$ {
|
||||
add_header Cache-Control "public, max-age=1209600";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user