nginx.conf 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. worker_processes auto;
  2. error_log /dev/stdout info;
  3. pid /var/run/nginx.pid;
  4. events {
  5. worker_connections 1024;
  6. }
  7. http {
  8. include /etc/nginx/mime.types;
  9. default_type application/octet-stream;
  10. log_format http '$time_iso8601 $remote_addr "$request" $status -> $upstream_addr '
  11. 'sent=$body_bytes_sent ssl=$ssl_protocol/$ssl_cipher '
  12. 'dur=$request_time';
  13. access_log /dev/stdout http;
  14. # POST / is the Kerberos auth endpoint; every other request that isn't
  15. # static content belongs to the Web API.
  16. map "$request_method $uri" $backend {
  17. default webapi;
  18. "POST /" kerberos;
  19. }
  20. upstream kerberos {
  21. server open-oscar-server:1088;
  22. }
  23. upstream webapi {
  24. server open-oscar-server:8081;
  25. # The Flash client sends a request per keystroke burst and polls every
  26. # 500ms. Without a pool every one of those opens a new connection to the
  27. # server, and a connect that stalls costs the client its event loop.
  28. keepalive 32;
  29. }
  30. server {
  31. listen 80;
  32. listen 443 ssl;
  33. ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
  34. # allow legacy ciphers required by 2000s-era AIM clients
  35. ssl_ciphers ALL:!aNULL;
  36. ssl_prefer_server_ciphers off;
  37. ssl_certificate /etc/nginx/certs/server.pem;
  38. ssl_certificate_key /etc/nginx/certs/server.pem;
  39. ssl_dhparam /etc/nginx/dhparam.pem;
  40. ssl_session_cache shared:HTTPSSL:10m;
  41. ssl_session_timeout 5m;
  42. ssl_session_tickets off;
  43. client_max_body_size 10m;
  44. # relative Location headers, so redirects keep the requested port.
  45. absolute_redirect off;
  46. # required for the upstream keepalive pool
  47. proxy_http_version 1.1;
  48. proxy_set_header Connection "";
  49. proxy_set_header Host $http_host;
  50. proxy_set_header X-Real-IP $remote_addr;
  51. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  52. proxy_set_header X-Forwarded-Proto $scheme;
  53. proxy_connect_timeout 10s;
  54. # /aim/fetchEvents long-polls for up to 60 seconds.
  55. proxy_read_timeout 120s;
  56. proxy_send_timeout 120s;
  57. # load static web content for AIM web clients
  58. location = /client {
  59. return 301 /client/;
  60. }
  61. location ^~ /client/ {
  62. root /srv;
  63. index index.html;
  64. # js and css are the only assets big enough to be worth
  65. # compressing; the images already are.
  66. gzip on;
  67. gzip_types text/css application/javascript;
  68. gzip_min_length 1024;
  69. gzip_vary on;
  70. }
  71. # route remaining traffic to the backend selected by $backend
  72. location / {
  73. proxy_pass http://$backend;
  74. }
  75. }
  76. }
  77. stream {
  78. log_format proxy '$remote_addr -> $upstream_addr $protocol $status '
  79. 'ssl=$ssl_protocol/$ssl_cipher sent=$bytes_sent '
  80. 'recv=$bytes_received dur=$session_time';
  81. access_log /dev/stdout proxy;
  82. ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
  83. ssl_ciphers ALL:!aNULL;
  84. ssl_prefer_server_ciphers off;
  85. ssl_certificate /etc/nginx/certs/server.pem;
  86. ssl_certificate_key /etc/nginx/certs/server.pem;
  87. ssl_dhparam /etc/nginx/dhparam.pem;
  88. ssl_session_cache shared:STREAMSSL:10m;
  89. ssl_session_timeout 5m;
  90. ssl_session_tickets off;
  91. proxy_connect_timeout 10s;
  92. # a client going away ends the whole session rather than leaving the
  93. # upstream half open.
  94. proxy_half_close off;
  95. # clients send FLAP keep-alive frames every couple of minutes, so a
  96. # connection quiet for this long is dead.
  97. proxy_timeout 10m;
  98. # BOS SSL listener
  99. server {
  100. listen 5193 ssl;
  101. proxy_pass open-oscar-server:5191;
  102. }
  103. }