Skip to content

A self-hosted media server and file management system

nginx config?

aminnausine243c13eaa9f
diff --git a/docker/caddy/CaddyFile b/docker/caddy/CaddyFile
index 63c058c7..916bf412 100644
--- a/docker/caddy/CaddyFile
+++ b/docker/caddy/CaddyFile
@@ -21,4 +21,16 @@
output file /var/log/caddy.log
level debug
}
+
+ @ws {
+ header Connection *Upgrade*
+ header Upgrade websocket
+ }
+
+ reverse_proxy @ws ws
+ reverse_proxy app
+
+ tls /var/lib/acme/app.test/cert.pem /var/lib/acme/app.test/key.pem {
+ protocols tls1.3
+ }
}
diff --git a/docker/nginx/app.conf b/docker/nginx/app.conf
new file mode 100644
index 00000000..594fa5c2
--- /dev/null
+++ b/docker/nginx/app.conf
@@ -0,0 +1,65 @@
+server {
+ listen 80;
+ server_name app.test;
+
+ add_header X-Frame-Options "SAMEORIGIN";
+ add_header X-Content-Type-Options "nosniff";
+
+ index index.php;
+
+ root /var/www/mediaServer/public
+
+ location /app {
+ proxy_http_version 1.1;
+ proxy_set_header Host $host;
+ proxy_set_header Scheme $scheme;
+ proxy_set_header SERVER_PORT $server_port;
+ proxy_set_header REMOTE_ADDR $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection "Upgrade";
+
+ proxy_pass http://0.0.0.0:6001;
+ }
+
+ location / {
+ try_files $uri $uri/ /index.php?$query_string;
+ autoindex off;
+ }
+
+ location ~ \.php$ {
+
+
+ fastcgi_split_path_info ^(.+\.php)(/.+)$;
+ try_files $fastcgi_script_name =404;
+
+ set $path_info $fastcgi_path_info;
+ fastcgi_param PATH_INFO $path_info;
+ fastcgi_read_timeout 3600;
+
+ fastcgi_index index.php;
+
+ include fastcgi.conf;
+ include fastcgi_params;
+
+
+ fastcgi_pass app:9000;
+ fastcgi_hide_header X-Powered-By;
+ }
+
+ charset utf-8;
+
+ location = /favicon.ico { access_log off; log_not_found off; }
+ location = /robots.txt { access_log off; log_not_found off; }
+
+ location ~ /\.(?!well-known).* {
+ deny all;
+ }
+
+ location /storage/media/ {
+ valid_referers app.test ;
+ if ($invalid_referer) {
+ return 403;
+ }
+ }
+}