nginx_file 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ##
  2. # You should look at the following URL's in order to grasp a solid understanding
  3. # of Nginx configuration files in order to fully unleash the power of Nginx.
  4. # http://wiki.nginx.org/Pitfalls
  5. # http://wiki.nginx.org/QuickStart
  6. # http://wiki.nginx.org/Configuration
  7. #
  8. # Generally, you will want to move this file somewhere, and start with a clean
  9. # file but keep this around for reference. Or just disable in sites-enabled.
  10. #
  11. # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
  12. ##
  13. # Default server configuration
  14. #
  15. server {
  16. listen 80 default_server;
  17. listen [::]:80 default_server;
  18. root /home/david/git/irc-books/front/;
  19. index index.html index.htm index.nginx-debian.html;
  20. server_name _;
  21. location ~ /books {
  22. alias /tmp/books/;
  23. location ~ \.(epub|mobi|azw3)$ {
  24. alias /tmp/;
  25. add_header Content-disposition "attachment";
  26. try_files $uri =404;
  27. }
  28. autoindex on;
  29. }
  30. location / {
  31. if ($http_user_agent ~* "armv7l") {
  32. rewrite ^/(.*)$ /books;
  33. }
  34. # First attempt to serve request as file, then
  35. # as directory, then fall back to displaying a 404.
  36. try_files $uri $uri/ =404;
  37. }
  38. }
  39. server {
  40. listen 8099;
  41. location / {
  42. proxy_pass http://localhost:8081;
  43. proxy_http_version 1.1;
  44. proxy_set_header Upgrade $http_upgrade;
  45. proxy_set_header Connection "Upgrade";
  46. }
  47. }