Просмотр исходного кода

Grant nginx traversal permission to static files directory

nginx runs as www-data which can't traverse the user's home directory
(default 700/750 perms). Add chmod o+x on each parent directory up to
root so nginx can reach INSTALL_DIR/static/dist/.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
tuanchris 4 месяцев назад
Родитель
Сommit
eec0a740ad
1 измененных файлов с 8 добавлено и 0 удалено
  1. 8 0
      setup-pi.sh

+ 8 - 0
setup-pi.sh

@@ -289,6 +289,14 @@ deploy_native() {
     npm run build
     cd "$INSTALL_DIR"
 
+    # Ensure nginx (www-data) can traverse to static files
+    # chmod o+x grants traversal only, not directory listing
+    local dir="$INSTALL_DIR"
+    while [[ "$dir" != "/" ]]; do
+        sudo chmod o+x "$dir"
+        dir=$(dirname "$dir")
+    done
+
     # Configure nginx
     print_step "Configuring nginx..."
     sudo cp "$INSTALL_DIR/nginx/dune-weaver.conf" /etc/nginx/sites-available/dune-weaver.conf