1
0

nginx.conf 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. server {
  2. listen 8109;
  3. listen [::]:8109;
  4. set $app_root '/home/hi/p/cityapper-com-school/demos/notes-app/day-2';
  5. root $app_root;
  6. auth_basic_user_file $app_root/.htpasswd;
  7. auth_basic "Restricted";
  8. # Add index.php to the list if you are using PHP
  9. index index.html;
  10. #server_name hi-pi-64.local;
  11. location / {
  12. # First attempt to serve request as file, then
  13. # as directory, then fall back to displaying a 404.
  14. try_files $uri $uri/ =404;
  15. }
  16. location /storage {
  17. autoindex on;
  18. alias $app_root/storage;
  19. # Preflighted requests
  20. if ($request_method = OPTIONS) {
  21. add_header "Access-Control-Allow-Origin" *;
  22. add_header "Access-Control-Allow-Methods" "GET, HEAD, POST, PUT, OPTIONS, MOVE, DELETE, COPY, LOCK, UNLOCK, PROPFIND";
  23. add_header "Access-Control-Allow-Headers" "Authorization, Origin, X-Requested-With, Content-Type, Accept, DNT, X-CustomHeader, Keep-Alive,User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Range, Range, Depth";
  24. return 200;
  25. }
  26. if ($request_method = (GET|POST|HEAD|DELETE|PROPFIND)) {
  27. add_header "Access-Control-Allow-Origin" *;
  28. add_header "Access-Control-Allow-Methods" "GET, HEAD, POST, PUT, OPTIONS, MOVE, DELETE, COPY, LOCK, UNLOCK, PROPFIND";
  29. add_header "Access-Control-Allow-Headers" "Authorization, Origin, X-Requested-With, Content-Type, Accept";
  30. }
  31. # dav allowed method
  32. dav_methods PUT DELETE MKCOL COPY MOVE;
  33. # Allow current scope perform specified DAV method
  34. dav_ext_methods PROPFIND OPTIONS;
  35. # In this folder, newly created folder or file is to have specified permission. If none is given, default is user:rw. If all or group permission is specified, user could be skipped
  36. dav_access user:rw group:rw all:r;
  37. # Temporary folder
  38. client_body_temp_path /tmp;
  39. # MAX size of uploaded file, 0 mean unlimited
  40. client_max_body_size 0;
  41. # Allow autocreate folder here if necessary
  42. create_full_put_path on;
  43. }
  44. }