From d51c58c8037f8369aaa7ea61d51e9f2c856392d6 Mon Sep 17 00:00:00 2001
From: Julian Rother <julianr@fsmpi.rwth-aachen.de>
Date: Sat, 15 Oct 2016 01:46:38 +0200
Subject: [PATCH] Added minimal nginx config to test permission features

---
 .gitignore         |  5 +++++
 README.md          |  2 ++
 nginx.conf.example | 52 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 59 insertions(+)
 create mode 100644 nginx.conf.example

diff --git a/.gitignore b/.gitignore
index bf258de..a4b010e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,5 +2,10 @@
 config.py
 __pycache__
 *.sqlite
+files
 files/*
 static/500.html
+nginx.err.log
+nginx.log
+nginx.pid
+uwsgi.sock
diff --git a/README.md b/README.md
index f9d509d..36c1500 100644
--- a/README.md
+++ b/README.md
@@ -14,6 +14,8 @@ SQLITE_INIT_DATA sollte also wenigstens beim ersten Durchlauf True sein)
 6. unter [http://localhost:5000](http://localhost:5000) ist die Website verfügbar
 7. Moderatorlogin mit user: `videoag` Passwort: `videoag`
 
+Alternativ, insbesondere zum Testen der Zugriffsbeschränkungen: Siehe `nginx.example.py`.
+
 ### Zum Mitmachen:
 1. Repo zum User clonen, dafür den "Clone-Button auf der Website verwenden
 2. Weiter mit 'Zum Testen'
diff --git a/nginx.conf.example b/nginx.conf.example
new file mode 100644
index 0000000..fe6363e
--- /dev/null
+++ b/nginx.conf.example
@@ -0,0 +1,52 @@
+# Debug-only nginx config for this website
+#
+# Requires system-wide installation of nginx (for /etc/nginx/*)
+#
+# 1. Start nginx
+#  nginx -c nginx.conf.example -p .
+# 2. Start uwsgi
+#  uwsgi -s uwsgi.sock --manage-script-name --mount /=server:app --plugin python --enable-threads
+# 3. Visit http://localhost:5000/
+
+pid nginx.pid;
+error_log nginx.err.log;
+
+events {
+  worker_connections 768;
+}
+
+http {
+  access_log nginx.log;
+  client_body_in_file_only off;
+  include /etc/nginx/mime.types;
+  default_type application/octet-stream;
+  sendfile on;
+  tcp_nopush on;
+  tcp_nodelay on;
+  keepalive_timeout 65;
+  types_hash_max_size 2048;
+  server {
+    #listen 5000;
+    #listen [::]:5000;
+		listen localhost:5000;
+    error_page 502 /static/500.html;
+    location /static/ {
+      root .;
+    }
+    location /files/ {
+      auth_request /auth;
+			# For use with sshfs (recommended)
+      	#alias /mnt/videoag/srv/videoag/released/;
+			# For use without sshfs
+      	proxy_pass https://videoag.fsmpi.rwth-aachen.de/;
+      	proxy_set_header Host "videoag.fsmpi.rwth-aachen.de";
+    }
+    location / {
+			include /etc/nginx/uwsgi_params;
+			uwsgi_param REQUEST_URI $uri;
+			uwsgi_param HTTP_X_ORIGINAL_URI $request_uri;
+			uwsgi_param HTTP_X_REAL_IP $remote_addr;
+			uwsgi_pass unix:uwsgi.sock;
+		}
+	}
+}
-- 
GitLab