nginx.conf 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #user nobody;
  2. worker_processes 1;
  3. #error_log logs/error.log;
  4. #error_log logs/error.log notice;
  5. #error_log logs/error.log info;
  6. #pid logs/nginx.pid;
  7. events {
  8. worker_connections 1024;
  9. }
  10. http {
  11. include mime.types;
  12. default_type application/octet-stream;
  13. server {
  14. listen 80;
  15. location / {
  16. root /usr/share/nginx/html/dist;
  17. try_files $uri $uri/ /index.html;
  18. index index.html;
  19. # Enable CORS
  20. add_header 'Access-Control-Allow-Origin' '*';
  21. add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
  22. add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
  23. if ($request_method = 'OPTIONS') {
  24. add_header 'Access-Control-Max-Age' 1728000;
  25. add_header 'Content-Type' 'text/plain charset=UTF-8';
  26. add_header 'Content-Length' 0;
  27. return 204;
  28. }
  29. if ($request_filename ~* ^.*?.(html|htm|js)$) {
  30. add_header Cache-Control no-cache;
  31. }
  32. }
  33. }
  34. }