server { listen 8109; listen [::]:8109; set $app_root '/home/hi/p/cityapper-com-school/demos/notes-app/day-2'; root $app_root; auth_basic_user_file $app_root/.htpasswd; auth_basic "Restricted"; # Add index.php to the list if you are using PHP index index.html; #server_name hi-pi-64.local; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; } location /storage { autoindex on; alias $app_root/storage; # Preflighted requests if ($request_method = OPTIONS) { add_header "Access-Control-Allow-Origin" *; add_header "Access-Control-Allow-Methods" "GET, HEAD, POST, PUT, OPTIONS, MOVE, DELETE, COPY, LOCK, UNLOCK, PROPFIND"; 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"; return 200; } if ($request_method = (GET|POST|HEAD|DELETE|PROPFIND)) { add_header "Access-Control-Allow-Origin" *; add_header "Access-Control-Allow-Methods" "GET, HEAD, POST, PUT, OPTIONS, MOVE, DELETE, COPY, LOCK, UNLOCK, PROPFIND"; add_header "Access-Control-Allow-Headers" "Authorization, Origin, X-Requested-With, Content-Type, Accept"; } # dav allowed method dav_methods PUT DELETE MKCOL COPY MOVE; # Allow current scope perform specified DAV method dav_ext_methods PROPFIND OPTIONS; # 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 dav_access user:rw group:rw all:r; # Temporary folder client_body_temp_path /tmp; # MAX size of uploaded file, 0 mean unlimited client_max_body_size 0; # Allow autocreate folder here if necessary create_full_put_path on; } }