From de3ffef0e46f7d9064a21eab0e73693975f3c182 Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Thu, 22 Aug 2013 20:34:15 +0200 Subject: [PATCH] Modification : nginx root configurable. --- etc/agendav/config.php | 8 ++++---- etc/nginx/site.d/agendav/site.conf | 6 +++--- etc/nginx/site.d/cyclocamp-www/site.conf | 2 +- etc/nginx/site.d/lhc-remorque/ikiwiki.setup | 4 ++-- etc/nginx/site.d/lhc-remorque/local.sh | 6 +++--- etc/nginx/site.d/lhc-remorque/site.conf | 2 +- etc/nginx/site.d/ptitvelo-www/site.conf | 3 ++- etc/nginx/site.d/roundcube/site.conf | 2 +- etc/roundcube/main.inc.php | 2 +- etc/sv/nginx/local.sh | 10 ++++++---- local/www-init | 4 ++-- 11 files changed, 26 insertions(+), 23 deletions(-) diff --git a/etc/agendav/config.php b/etc/agendav/config.php index 232d708..262dcb4 100755 --- a/etc/agendav/config.php +++ b/etc/agendav/config.php @@ -1,7 +1,7 @@ [], srcdir => "/home/lhc/var/ikiwiki/remorque", - destdir => "/home/www/pub/lhc-remorque", + destdir => "/home/www/data/lhc-remorque", #templatedir => "/home/lhc/var/ikiwiki/remorque/tmpl", templatedir => '/usr/share/ikiwiki/templates', underlaydir => '/usr/share/ikiwiki/basewiki', @@ -29,7 +29,7 @@ use IkiWiki::Setup::Standard { gitmaster_branch => "master", wrappers => [ { cgi => 1 - , wrapper => "/home/www/pub/lhc-remorque/cgi/ikiwiki.cgi" + , wrapper => "/home/www/data/lhc-remorque/cgi/ikiwiki.cgi" , wrappermode => "00750" } , { post_commit => 1 diff --git a/etc/nginx/site.d/lhc-remorque/local.sh b/etc/nginx/site.d/lhc-remorque/local.sh index 9ec7bdb..beebcd3 100644 --- a/etc/nginx/site.d/lhc-remorque/local.sh +++ b/etc/nginx/site.d/lhc-remorque/local.sh @@ -13,14 +13,14 @@ sudo install -m 664 -o www -g www \ --disabled-login \ --disabled-password \ --group \ - --home /home/www/pub/"$site" \ + --home /home/www/data/"$site" \ --shell /bin/false \ --system "$tool"/local/adduser www-"$site" \ --disabled-login \ --disabled-password \ --group \ - --home /home/www/pub/"$site" \ + --home /home/www/data/"$site" \ --shell /bin/false \ --system sudo adduser fcgi-"$site" www-"$site" @@ -70,7 +70,7 @@ sudo install -m 400 -o wiki-"$site" -g wiki-"$site" \ /home/lhc/var/ikiwiki/remorque/etc/ikiwiki.setup sudo adduser wiki-"$site" www-"$site" sudo install -d -m 2770 -o wiki-"$site" -g fcgi-"$site" \ - /home/www/pub/"$site"/cgi + /home/www/data/"$site"/cgi cd / sudo -u wiki-"$site" ikiwiki \ --verbose \ diff --git a/etc/nginx/site.d/lhc-remorque/site.conf b/etc/nginx/site.d/lhc-remorque/site.conf index e8010a4..959b8cd 100644 --- a/etc/nginx/site.d/lhc-remorque/site.conf +++ b/etc/nginx/site.d/lhc-remorque/site.conf @@ -3,7 +3,7 @@ server_name ra.heureux-cyclage.org; auth_basic "pour demander un compte: admin@heureux-cyclage.org"; -auth_basic_user_file /home/www/pub/lhc-remorque/.htpasswd; +auth_basic_user_file /home/www/data/lhc-remorque/.htpasswd; client_body_buffer_size 8k; client_max_body_size 10m; diff --git a/etc/nginx/site.d/ptitvelo-www/site.conf b/etc/nginx/site.d/ptitvelo-www/site.conf index 66c920d..45a7d8a 100644 --- a/etc/nginx/site.d/ptitvelo-www/site.conf +++ b/etc/nginx/site.d/ptitvelo-www/site.conf @@ -1,7 +1,8 @@ -server_name +server_name ptitvelo.heureux-cyclage.org www.ptitvelo.net ptitvelo.net; +root /home/www/data/ptitvelo-www/www; client_body_buffer_size 8k; client_max_body_size 10m; diff --git a/etc/nginx/site.d/roundcube/site.conf b/etc/nginx/site.d/roundcube/site.conf index 670b105..c8fd7cb 100644 --- a/etc/nginx/site.d/roundcube/site.conf +++ b/etc/nginx/site.d/roundcube/site.conf @@ -32,7 +32,7 @@ location ~ ^/(bin|SQL)/ { deny all; } location ~ ^/images/.+(png) { - root /home/www/pub/roundcube; + root /home/www/data/roundcube; access_log off; expires 30d; log_not_found off; diff --git a/etc/roundcube/main.inc.php b/etc/roundcube/main.inc.php index f71f883..94a5edc 100644 --- a/etc/roundcube/main.inc.php +++ b/etc/roundcube/main.inc.php @@ -215,7 +215,7 @@ $rcmail_config['auto_create_user'] = true; // replace Roundcube logo with this image // specify an URL relative to the document root of this Roundcube installation -if (file_exists("/home/www/pub/roundcube/images/logo-$http_host.png")) { +if (file_exists("/home/www/data/roundcube/images/logo-$http_host.png")) { $rcmail_config['skin_logo'] = "./images/logo-$http_host.png"; } else { diff --git a/etc/sv/nginx/local.sh b/etc/sv/nginx/local.sh index 0b014f7..e7331d4 100644 --- a/etc/sv/nginx/local.sh +++ b/etc/sv/nginx/local.sh @@ -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; } diff --git a/local/www-init b/local/www-init index 1c3d8d3..5dc05b2 100755 --- a/local/www-init +++ b/local/www-init @@ -20,12 +20,12 @@ tool=$(readlink -e "${0%/*}/..") #sudo adduser www www-data sudo adduser www log-www #sudo adduser log log-www -usermod --home /home/www/pub www-data +usermod --home /home/www/data www-data sudo install -d -m 751 -o www -g www \ /home/www sudo install -d -m 750 -o www -g www \ /home/www/etc sudo install -d -m 1771 -o www-data -g www-data \ - /home/www/pub + /home/www/data sudo install -d -m 1771 -o log-www -g log-www \ /home/www/log -- 2.20.1