Bladeren bron

add basic nginx file with kindle redirect and ws upgrade

david 8 jaren geleden
bovenliggende
commit
9c84333678
1 gewijzigde bestanden met toevoegingen van 51 en 0 verwijderingen
  1. 51 0
      nginx_file

+ 51 - 0
nginx_file

@@ -0,0 +1,51 @@
+##
+# You should look at the following URL's in order to grasp a solid understanding
+# of Nginx configuration files in order to fully unleash the power of Nginx.
+# http://wiki.nginx.org/Pitfalls
+# http://wiki.nginx.org/QuickStart
+# http://wiki.nginx.org/Configuration
+#
+# Generally, you will want to move this file somewhere, and start with a clean
+# file but keep this around for reference. Or just disable in sites-enabled.
+#
+# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
+##
+
+# Default server configuration
+#
+server {
+    listen 80 default_server;
+    listen [::]:80 default_server;
+    root /home/david/git/irc-books/front/;
+
+    index index.html index.htm index.nginx-debian.html;
+    server_name _;
+
+    location ~ /books {
+        alias /tmp/books/;
+        location ~ \.(epub|mobi|azw3)$ {
+            alias /tmp/;
+            add_header Content-disposition "attachment";
+            try_files $uri =404;
+        }
+        autoindex on;
+    }
+    location / {
+        if ($http_user_agent ~* "armv7l") {
+            rewrite ^/(.*)$ /books;
+        }
+        # First attempt to serve request as file, then
+        # as directory, then fall back to displaying a 404.
+        try_files $uri $uri/ =404;
+    }
+}
+
+server {
+    listen 8099;
+    location / {
+        proxy_pass http://localhost:8081;
+        proxy_http_version 1.1;
+        proxy_set_header Upgrade $http_upgrade;
+        proxy_set_header Connection "Upgrade";
+    }
+}