nginx-crm.conf 881 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. upstream unicorn {
  2. server crm:3001;
  3. }
  4. server {
  5. server_name localhost;
  6. root $RAILS_ROOT/public;
  7. index index.html;
  8. access_log $RAILS_ROOT/log/nginx.access.log;
  9. error_log $RAILS_ROOT/log/nginx.error.log;
  10. location ~ /\. {
  11. deny all;
  12. }
  13. location ~* ^.+\.(rb|log)$ {
  14. deny all;
  15. }
  16. location ~ ^/(assets|images|javascripts|stylesheets|swfs|system)/ {
  17. try_files $uri @rails;
  18. access_log off;
  19. gzip_static on; # to serve pre-gzipped version
  20. expires max;
  21. add_header Cache-Control public;
  22. add_header Last-Modified "";
  23. add_header ETag "";
  24. break;
  25. }
  26. location / {
  27. try_files $uri @rails;
  28. }
  29. location @rails {
  30. proxy_set_header X-Real-IP $remote_addr;
  31. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  32. proxy_set_header Host $http_host;
  33. proxy_redirect off;
  34. proxy_pass http://unicorn;
  35. }
  36. }