nginx.conf 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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. # client trust material: the root CA and the AIM 6.x NSS database.
  72. # The whole certs dir is mounted under /srv/certs, so only expose
  73. # these paths and never the server's private key.
  74. location = /certs/ca.crt {
  75. root /srv;
  76. }
  77. location = /certs/nss {
  78. return 301 /certs/nss/;
  79. }
  80. location ^~ /certs/nss/ {
  81. root /srv;
  82. autoindex on;
  83. }
  84. location ^~ /certs/ {
  85. return 404;
  86. }
  87. # route remaining traffic to the backend selected by $backend
  88. location / {
  89. proxy_pass http://$backend;
  90. }
  91. }
  92. }
  93. stream {
  94. log_format proxy '$remote_addr -> $upstream_addr $protocol $status '
  95. 'ssl=$ssl_protocol/$ssl_cipher sent=$bytes_sent '
  96. 'recv=$bytes_received dur=$session_time';
  97. access_log /dev/stdout proxy;
  98. ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
  99. ssl_ciphers ALL:!aNULL;
  100. ssl_prefer_server_ciphers off;
  101. ssl_certificate /etc/nginx/certs/server.pem;
  102. ssl_certificate_key /etc/nginx/certs/server.pem;
  103. ssl_dhparam /etc/nginx/dhparam.pem;
  104. ssl_session_cache shared:STREAMSSL:10m;
  105. ssl_session_timeout 5m;
  106. ssl_session_tickets off;
  107. proxy_connect_timeout 10s;
  108. # a client going away ends the whole session rather than leaving the
  109. # upstream half open.
  110. proxy_half_close off;
  111. # clients send FLAP keep-alive frames every couple of minutes, so a
  112. # connection quiet for this long is dead.
  113. proxy_timeout 10m;
  114. # BOS SSL listener
  115. server {
  116. listen 5193 ssl;
  117. proxy_pass open-oscar-server:5191;
  118. }
  119. }