Modification : nginx root configurable.
[lhc/ateliers.git] / etc / sv / nginx / local.sh
index 0b014f7..e7331d4 100644 (file)
@@ -37,7 +37,7 @@ for site in $(find "$tool"/etc/nginx/site.d \
         --disabled-login \
         --disabled-password \
         --group \
-        --home /home/www/pub/"$site" \
+        --home /home/www/data/"$site" \
         --shell /bin/false \
         --system
        "$tool"/local/adduser log-www-"$site" \
@@ -53,9 +53,9 @@ for site in $(find "$tool"/etc/nginx/site.d \
         /etc/nginx/site.d/"$site"
        sudo install -d -m 770 -o www -g www \
         /etc/nginx/x509.d/"$site"
-       sudo test -L /home/www/pub/"$site" ||
+       sudo test -L /home/www/data/"$site" ||
        sudo install -d -m 2770 -o www-"$site" -g www-"$site" \
-        /home/www/pub/"$site"
+        /home/www/data/"$site"
        sudo adduser www-data www-"$site"
        sudo adduser www-data log-www-"$site"
        sudo install -m 660 -o www -g www \
@@ -80,7 +80,9 @@ for site in $(find "$tool"/etc/nginx/site.d \
                server {
                        access_log /home/www/log/$site/nginx/access.log main;
                        error_log  /home/www/log/$site/nginx/error.log warn;
-                       root       /home/www/pub/$site;
+                       $(if ! grep -q '^root\>' "$tool"/etc/nginx/site.d/"$site"/site.conf
+                               then printf 'root %s;' /home/www/data/"$site"
+                               fi)
                        include    /etc/nginx/site.d/$site/local.conf;
                        include    /etc/nginx/site.d/$site/site.conf;
                 }