aboutsummaryrefslogtreecommitdiffstats
path: root/ansible/roles/nginx/files
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2023-08-13 14:59:36 +0100
committerGravatar Chris Lovering <[email protected]>2023-08-13 15:54:03 +0100
commit431585b5256a0d08f4f3c33122465a88a93ddcb1 (patch)
tree4cc41cda81655332fa467e6c9c85d1ee9c35b90e /ansible/roles/nginx/files
parentServe static files from Turing (#116) (diff)
Move all ansible files to their own folder
Diffstat (limited to 'ansible/roles/nginx/files')
-rw-r--r--ansible/roles/nginx/files/default_server.conf32
-rw-r--r--ansible/roles/nginx/files/files.pydis.wtf10
2 files changed, 42 insertions, 0 deletions
diff --git a/ansible/roles/nginx/files/default_server.conf b/ansible/roles/nginx/files/default_server.conf
new file mode 100644
index 0000000..1d68ff5
--- /dev/null
+++ b/ansible/roles/nginx/files/default_server.conf
@@ -0,0 +1,32 @@
+# Managed by Ansible
+server {
+ listen 80 default_server;
+
+ server_name _;
+
+ return 301 https://$host$request_uri;
+}
+
+server {
+ listen 443 ssl http2 default_server;
+
+ ssl_certificate /etc/letsencrypt/live/pydis.wtf/fullchain.pem;
+ ssl_certificate_key /etc/letsencrypt/live/pydis.wtf/privkey.pem;
+
+ location / {
+ set_by_lua_block $url {
+ local urls = {
+ "https://fasterthanli.me/articles/i-want-off-mr-golangs-wild-ride",
+ "https://en.wikipedia.org/wiki/Tax_evasion",
+ "https://jchri.st/blog/apfs-sadness-on-macos-big-sur.html",
+ "https://cdn.discordapp.com/attachments/675756741417369640/852688961516077086/Screenshot_2021-06-11_at_00.21.22.png",
+ "https://news.ycombinator.com/",
+ "https://www.hertfordshire.gov.uk/latest/letchworth-webcam.jpg",
+ "https://media.discordapp.net/attachments/922169059175444501/952929630459924501/1svkf3xto3n61.png"
+ }
+ return urls [ math.random(#urls) ]
+ }
+
+ return 302 $url;
+ }
+}
diff --git a/ansible/roles/nginx/files/files.pydis.wtf b/ansible/roles/nginx/files/files.pydis.wtf
new file mode 100644
index 0000000..db8416e
--- /dev/null
+++ b/ansible/roles/nginx/files/files.pydis.wtf
@@ -0,0 +1,10 @@
+# Managed by Ansible
+server {
+ listen 443;
+ server_name files.pydis.wtf;
+ root /var/www/turing;
+
+ location / {
+ try_files $uri $uri/;
+ }
+}