mastodon.conf 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. upstream mastodon {
  16. server mastodon-service-dockerbunker:3000;
  17. }
  18. upstream mastodon-streaming {
  19. server mastodon-streaming-dockerbunker:4000;
  20. }
  21. server {
  22. listen 80;
  23. server_name ${SERVICE_DOMAIN};
  24. return 301 https://$host$request_uri;
  25. add_header X-Content-Type-Options "nosniff" always;
  26. add_header X-XSS-Protection "1; mode=block" always;
  27. add_header X-Frame-Options "DENY" always;
  28. add_header Referrer-Policy "strict-origin" always;
  29. add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
  30. server_tokens off;
  31. }
  32. server {
  33. listen 443;
  34. server_name ${SERVICE_DOMAIN};
  35. ssl on;
  36. ssl_certificate /etc/nginx/ssl/${SERVICE_DOMAIN}/cert.pem;
  37. ssl_certificate_key /etc/nginx/ssl/${SERVICE_DOMAIN}/key.pem;
  38. include /etc/nginx/includes/ssl.conf;
  39. add_header X-Content-Type-Options "nosniff" always;
  40. add_header X-XSS-Protection "1; mode=block" always;
  41. add_header X-Frame-Options "DENY" always;
  42. add_header Referrer-Policy "strict-origin" always;
  43. add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
  44. server_tokens off;
  45. include /etc/nginx/includes/gzip.conf;
  46. location / {
  47. proxy_pass http://mastodon/;
  48. proxy_set_header Host $http_host; # required for docker client's sake
  49. proxy_set_header X-Real-IP $remote_addr; # pass on real client's IP
  50. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  51. proxy_set_header X-Forwarded-Proto $scheme;
  52. proxy_read_timeout 900;
  53. }
  54. location /api/v1/streaming {
  55. proxy_set_header Host $host;
  56. proxy_set_header X-Real-IP $remote_addr;
  57. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  58. proxy_set_header X-Forwarded-Proto https;
  59. proxy_set_header Proxy "";
  60. proxy_pass http://mastodon-streaming/;
  61. proxy_buffering off;
  62. proxy_redirect off;
  63. proxy_http_version 1.1;
  64. # proxy_set_header Upgrade $http_upgrade;
  65. # proxy_set_header Connection $connection_upgrade;
  66. tcp_nodelay on;
  67. }
  68. location ~ /.well-known {
  69. allow all;
  70. root /var/www/html;
  71. }
  72. }