Modification : nginx root configurable.
[lhc/ateliers.git] / etc / sv / nginx / local.sh
index dd3bd8e..e7331d4 100644 (file)
@@ -1,5 +1,5 @@
 "$tool"/local/runit-sv-configure php5-fpm '*'
-"$tool"/local/runit-sv-restart   php5-fpm
+"$tool"/local/runit-sv-start     php5-fpm
 "$tool"/local/apt-get-install nginx spawn-fcgi fcgiwrap
 "$tool"/local/insserv-remove  nginx
 "$tool"/local/insserv-remove fcgiwrap
@@ -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,13 +80,16 @@ 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;
                 }
                EOF
        (
-       test ! -r "$tool"/etc/nginx/site.d/"$site"/configure.sh ||
-       .         "$tool"/etc/nginx/site.d/"$site"/configure.sh || return 1
+       cd /
+       test ! -r "$tool"/etc/nginx/site.d/"$site"/local.sh ||
+       .         "$tool"/etc/nginx/site.d/"$site"/local.sh || return 1
        )
  done