default.conf 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. # Cache zone
  2. proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=STATIC:10m inactive=7d use_temp_path=off;
  3. upstream nextjs {
  4. server 127.0.0.1:3000;
  5. }
  6. server {
  7. listen 80 default_server;
  8. server_name _;
  9. server_tokens off;
  10. gzip on;
  11. gzip_proxied any;
  12. gzip_comp_level 4;
  13. gzip_types text/css application/javascript image/svg+xml;
  14. proxy_http_version 1.1;
  15. proxy_set_header Upgrade $http_upgrade;
  16. proxy_set_header Connection 'upgrade';
  17. proxy_set_header Host $host;
  18. proxy_cache_bypass $http_upgrade;
  19. location /ping {
  20. return 200 'ssl-nginx-PONG!: $http_upgrade';
  21. add_header Content-Type text/plain;
  22. }
  23. # # BUILT ASSETS (E.G. JS BUNDLES)
  24. # # Browser cache - max cache headers from Next.js as build id in url
  25. # # Server cache - valid forever (cleared after cache "inactive" period)
  26. # location /_next/static {
  27. # proxy_cache STATIC;
  28. # proxy_pass http://nextjs;
  29. # }
  30. #
  31. # # STATIC ASSETS (E.G. IMAGES)
  32. # # Browser cache - "no-cache" headers from Next.js as no build id in url
  33. # # Server cache - refresh regularly in case of changes
  34. # location /static {
  35. # proxy_cache STATIC;
  36. # proxy_ignore_headers Cache-Control;
  37. # proxy_cache_valid 60m;
  38. # proxy_pass http://nextjs;
  39. # }
  40. # DYNAMIC ASSETS - NO CACHE
  41. location / {
  42. proxy_pass http://nextjs;
  43. }
  44. location ~ ^/alaa/api/v2/(.*)$ {
  45. proxy_redirect off;
  46. proxy_pass_request_headers on;
  47. proxy_pass http://192.168.8.12:700/api/v2/$1?$query_string;
  48. }
  49. location ~ ^/alaa/api/v1/(.*)$ {
  50. proxy_redirect off;
  51. proxy_pass_request_headers on;
  52. proxy_pass http://192.168.8.12:700/api/v1/$1?$query_string;
  53. }
  54. #
  55. # location /socket.io {
  56. # proxy_redirect off;
  57. # proxy_pass_request_headers on;
  58. # proxy_set_header Upgrade $http_upgrade;
  59. # proxy_set_header Connection "upgrade";
  60. # proxy_pass https://80.210.26.206:501;
  61. # }
  62. #
  63. # location /register-service-worker.js {
  64. # etag on;
  65. # expires 600s;
  66. # add_header Cache-Control "public, no-transform";
  67. # try_files $uri $uri/ /register-service-worker.js;
  68. # }
  69. #
  70. # location /firebase-messaging-sw.js {
  71. # etag on;
  72. # expires 600s;
  73. # add_header Cache-Control "public, no-transform";
  74. # try_files $uri $uri/ /firebase-messaging-sw.js;
  75. # }
  76. #
  77. # location ~* \.(js|css)$ {
  78. # etag on;
  79. # expires 600s;
  80. # add_header Cache-Control "public, no-transform";
  81. # try_files $uri $uri/ /index.html?$query_string;
  82. # }
  83. #
  84. # location ~* \.(ico|woff|woff2|ttf|svg|png|map|eot)$ {
  85. # etag on;
  86. # expires 10h;
  87. # add_header Cache-Control "public, no-transform";
  88. # try_files $uri $uri/ /index.html?$query_string;
  89. # }
  90. }