Add Nginx Cockpit Awareness

This commit is contained in:
t3chn0m4g3
2023-04-27 18:42:38 +02:00
parent a08a475f57
commit 5fd0d158e6
6 changed files with 152 additions and 5 deletions

View File

@ -5,6 +5,13 @@ load_module /usr/lib/nginx/modules/ngx_http_headers_more_filter_module.so;
load_module /usr/lib/nginx/modules/ngx_http_brotli_filter_module.so;
load_module /usr/lib/nginx/modules/ngx_http_brotli_static_module.so;
# OS ENV variables need to be defined here, so Lua can use them
env COCKPIT;
# Both modules are needed for Lua, in this exact order
load_module /usr/lib/nginx/modules/ndk_http_module.so;
load_module /usr/lib/nginx/modules/ngx_http_lua_module.so;
events {
worker_connections 768;
# multi_accept on;
@ -15,7 +22,6 @@ http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;

View File

@ -90,16 +90,23 @@ server {
auth_basic "closed site";
auth_basic_user_file /etc/nginx/nginxpasswd;
#############################
### T-Pot Landing Page & Apps
#############################
location / {
index index.html;
set_by_lua_block $index_file {
local cockpit = os.getenv("COCKPIT")
if cockpit == "false" then
return "index_light.html"
else
return "index.html"
end
}
auth_basic "closed site";
auth_basic_user_file /etc/nginx/nginxpasswd;
try_files $uri $uri/ /index.html;
index $index_file;
try_files $uri $uri/ /$index_file;
}
location /elasticvue {