You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
2.4 KiB

  1. user nginx;
  2. worker_processes {{ nginx_worker_processes }};
  3. error_log /var/log/nginx/error.log warn;
  4. pid /var/run/nginx.pid;
  5. events {
  6. worker_connections 1024;
  7. }
  8. http {
  9. include /etc/nginx/mime.types;
  10. default_type application/octet-stream;
  11. server_tokens off;
  12. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  13. '$status $body_bytes_sent "$http_referer" '
  14. '"$http_user_agent" "$http_x_forwarded_for"';
  15. access_log /var/log/nginx/access.log main;
  16. {% if nginx_enable_sendfile %}
  17. sendfile on;
  18. {% else %}
  19. sendfile off;
  20. {% endif %}
  21. # define a rate-limiting zone to use, and return HTTP 429 if exceeded
  22. limit_req_zone $binary_remote_addr zone=tildes_app:10m rate=4r/s;
  23. limit_req_status 429;
  24. keepalive_timeout 65;
  25. # redirect non-https accesses to the https version
  26. server {
  27. listen 80 default_server;
  28. listen [::]:80 default_server;
  29. server_name _;
  30. return 301 https://$host$request_uri;
  31. }
  32. gzip on;
  33. gzip_min_length 1000;
  34. gzip_comp_level 6;
  35. gzip_vary on;
  36. gzip_proxied any;
  37. # type list from https://github.com/h5bp/server-configs-nginx
  38. gzip_types
  39. application/atom+xml
  40. application/javascript
  41. application/json
  42. application/ld+json
  43. application/manifest+json
  44. application/rss+xml
  45. application/vnd.geo+json
  46. application/vnd.ms-fontobject
  47. application/x-font-ttf
  48. application/x-web-app-manifest+json
  49. application/xhtml+xml
  50. application/xml
  51. font/opentype
  52. image/bmp
  53. image/svg+xml
  54. image/x-icon
  55. text/cache-manifest
  56. text/css
  57. text/plain
  58. text/vcard
  59. text/vnd.rim.location.xloc
  60. text/vtt
  61. text/x-component
  62. text/x-cross-domain-policy;
  63. ssl_certificate {{ ssl_cert_path }};
  64. ssl_certificate_key {{ ssl_private_key_path }};
  65. ssl_session_timeout 1d;
  66. ssl_session_cache shared:SSL:50m;
  67. ssl_session_tickets off;
  68. # "modern" configuration from Mozilla guidelines
  69. ssl_protocols TLSv1.2;
  70. ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
  71. ssl_prefer_server_ciphers on;
  72. include /etc/nginx/sites-enabled/*.conf;
  73. }