📚Docs + Omada work #708

This commit is contained in:
jokob-sk
2024-06-29 10:28:14 +10:00
parent f64ebae3ee
commit eae93ef6b2
11 changed files with 239 additions and 70 deletions

View File

@@ -30,5 +30,5 @@ source myenv/bin/activate
update-alternatives --install /usr/bin/python python /usr/bin/python3 10
# install packages thru pip3
pip3 install tplink-omada-client pycryptodome requests paho-mqtt scapy cron-converter pytz json2table dhcp-leases pyunifi speedtest-cli chardet python-nmap dnspython cryptography
pip3 install netifaces tplink-omada-client pycryptodome requests paho-mqtt scapy cron-converter pytz json2table dhcp-leases pyunifi speedtest-cli chardet python-nmap dnspython cryptography

View File

@@ -1,3 +1,13 @@
# map $request_uri $auth_result {
# default "";
# ~^/api/ /auth_result;
# }
# log_format auth_request_log '$remote_addr - $remote_user [$time_local] '
# '"$request" $status $body_bytes_sent '
# '"$http_referer" "$http_user_agent" '
# '$auth_result';
server {
listen ${LISTEN_ADDR}:${PORT} default_server;
root ${INSTALL_DIR}/front;
@@ -5,45 +15,48 @@ server {
add_header X-Forwarded-Prefix "/app" always;
proxy_set_header X-Forwarded-Prefix "/app";
# # Increase buffer sizes to handle larger headers
# proxy_buffer_size 512k;
# proxy_buffers 16 512k;
# proxy_busy_buffers_size 512k;
# proxy_http_version 1.1;
# proxy_set_header Connection "";
# # Authentication endpoint
# location = /auth {
# internal;
# proxy_pass http://127.0.0.1/php/templates/auth.php;
# proxy_set_header Content-Length "";
# proxy_pass_request_body off;
# }
# # Whitelisting IP addresses and CORS for /api/
# location /api/ {
# auth_request /auth;
# access_log /var/log/nginx/auth_request.log auth_request_log;
# # Whitelisting IP addresses
# location /api/ {
# # Allow requests from localhost (loopback address)
# allow 127.0.0.1;
# # Allow requests from other trusted IP addresses
# # allow 192.168.1.0/24; # Replace with the actual IP of a trusted client
# # Deny all other IP addresses
# deny all;
# # Enable CORS for specific frontend domain
# add_header 'Access-Control-Allow-Origin' 'http://192.168.1.82:20211' always;
# add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
# add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type' always;
# add_header 'Access-Control-Allow-Credentials' 'true' always;
# # Enable CORS for specific frontend domain
# add_header 'Access-Control-Allow-Origin' 'http://vlan_ip' always;
# add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
# add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type' always;
# if ($request_method = 'OPTIONS') {
# return 204;
# }
# if ($request_method = 'OPTIONS') {
# return 204;
# }
# error_page 401 = @unauthorized;
# try_files $uri $uri/ =404;
# }
# # Other headers and configurations
# try_files $uri $uri/ =404;
# }
# location @unauthorized {
# return 401;
# }
location ~* \.php$ {
# Set Cache-Control header to prevent caching on the first load
add_header Cache-Control "no-store";
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_connect_timeout 75;
fastcgi_send_timeout 600;
fastcgi_read_timeout 600;
}
location ~* \.php$ {
# Set Cache-Control header to prevent caching on the first load
add_header Cache-Control "no-store";
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_connect_timeout 75;
fastcgi_send_timeout 600;
fastcgi_read_timeout 600;
}
}