Ajout : etc/nginx/org/heureux-cyclage/questionnaires
authorLudovic CHEVALIER <ludovic.chevalier@heureux-cyclage.org>
Thu, 23 Feb 2017 13:26:25 +0000 (14:26 +0100)
committerLudovic CHEVALIER <ludovic.chevalier@heureux-cyclage.org>
Thu, 23 Feb 2017 13:26:25 +0000 (14:26 +0100)
16 files changed:
srv/ateliers/etc/nginx/org/heureux-cyclage/questionnaires/... [new symlink]
srv/ateliers/etc/nginx/org/heureux-cyclage/questionnaires/common.conf.m4 [new file with mode: 0644]
srv/ateliers/etc/nginx/org/heureux-cyclage/questionnaires/install [new file with mode: 0755]
srv/ateliers/etc/nginx/org/heureux-cyclage/questionnaires/server.conf.m4 [new file with mode: 0644]
srv/ateliers/etc/php5/fpm/org/heureux-cyclage/questionnaires/... [new symlink]
srv/ateliers/etc/php5/fpm/org/heureux-cyclage/questionnaires/install [new symlink]
srv/ateliers/etc/php5/fpm/org/heureux-cyclage/questionnaires/php-fpm.conf.m4 [new file with mode: 0644]
srv/ateliers/sys/nginx/org/heureux-cyclage/questionnaires/... [new symlink]
srv/ateliers/sys/nginx/org/heureux-cyclage/questionnaires/home [new file with mode: 0644]
srv/ateliers/sys/nginx/org/heureux-cyclage/questionnaires/user [new file with mode: 0644]
srv/ateliers/sys/php5/fpm/org/heureux-cyclage/questionnaires/... [new symlink]
srv/ateliers/sys/php5/fpm/org/heureux-cyclage/questionnaires/home [new file with mode: 0644]
srv/ateliers/sys/php5/fpm/org/heureux-cyclage/questionnaires/log/... [new symlink]
srv/ateliers/sys/php5/fpm/org/heureux-cyclage/questionnaires/log/home [new file with mode: 0644]
srv/ateliers/sys/php5/fpm/org/heureux-cyclage/questionnaires/socket [new file with mode: 0644]
srv/ateliers/sys/php5/fpm/org/heureux-cyclage/questionnaires/user [new file with mode: 0644]

diff --git a/srv/ateliers/etc/nginx/org/heureux-cyclage/questionnaires/... b/srv/ateliers/etc/nginx/org/heureux-cyclage/questionnaires/...
new file mode 120000 (symlink)
index 0000000..951b30d
--- /dev/null
@@ -0,0 +1 @@
+../...
\ No newline at end of file
diff --git a/srv/ateliers/etc/nginx/org/heureux-cyclage/questionnaires/common.conf.m4 b/srv/ateliers/etc/nginx/org/heureux-cyclage/questionnaires/common.conf.m4
new file mode 100644 (file)
index 0000000..f1cffc0
--- /dev/null
@@ -0,0 +1,61 @@
+server_name
+ questionnaires.heureux-cyclage.org
+ formations.heureux-cyclage.org
+ rencontres.heureux-cyclage.org;
+root /home/www/data/org/heureux-cyclage/questionnaires;
+
+
+client_body_buffer_size 8k;
+client_max_body_size 10m;
+location / {
+       if ($host = "formations.heureux-cyclage.org") {
+               return 302 "$scheme://questionnaires.heureux-cyclage.org/index.php?r=survey/index&sid=367568";
+        }
+       if ($host = "rencontres.heureux-cyclage.org") {
+               return 302 "$scheme://questionnaires.heureux-cyclage.org/index.php?r=survey/index&sid=462499";
+        }
+       index index.html index.htm index.php;
+ }
+location ~* ^.+\.(css|gif|html|ico|jpeg|js|jpg|png|txt|xml)$ {
+       access_log off;
+       expires 30d;
+       log_not_found off;
+ }
+location ~ /\. {
+       access_log off;
+       deny all;
+       log_not_found off;
+ }
+location ~ \.php$ {
+       include /etc/nginx/conf.d/fastcgi.conf;
+       set $no_cache "0";
+       if ($request_method !~ ^(GET|HEAD)$) {
+        # NOTE: if non GET/HEAD, don't cache and mark user as uncacheable for 1 second via cookie.
+               set $no_cache "1";
+        }
+       if ($no_cache = "1") {
+        # NOTE: drop no cache cookie if need be (for some reason, add_header fails if included in prior if-block).
+               add_header Set-Cookie "_mcnc=1; Max-Age=2; Path=/";
+               add_header X-Microcachable "0";
+        }
+       if ($http_cookie ~* "_mcnc") {
+        # NOTE: bypass cache if no-cache cookie is set
+               set $no_cache "1";
+        }
+       fastcgi_cache_bypass $no_cache;
+       fastcgi_cache_use_stale updating;
+       fastcgi_cache_valid 200 10s;
+       fastcgi_cache_valid 404 10m;
+       fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
+       fastcgi_index index.php;
+       fastcgi_no_cache $no_cache;
+       fastcgi_param REDIRECT_STATUS 200;
+               # NOTE: PHP only, required if PHP was built with --enable-force-cgi-redirect
+       fastcgi_pass_header Cookie;
+       fastcgi_pass_header Set-Cookie;
+       fastcgi_split_path_info ^(.+\.php)(/.+)$;
+       
+       fastcgi_pass unix:/run/php5/fpm/lhc_quest;
+ }
+
+# vim: ft=sh
diff --git a/srv/ateliers/etc/nginx/org/heureux-cyclage/questionnaires/install b/srv/ateliers/etc/nginx/org/heureux-cyclage/questionnaires/install
new file mode 100755 (executable)
index 0000000..8a61502
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/sh -eu
+# SYNTAX: $path
+# DESCRIPTION: install
+
+# ACTION: initialize from .../lib/tool/admin/
+       tool=$(readlink -e "${0%/install}"/...)/lib/tool/admin
+       . "$tool"/lib/install.sh
+# ACTION: initialize $sv from ./sys/$sv/
+       sv=${cmd##*/etc/}
+       sv=${sv%%/*}
+# ACTION: initialize $site from ./etc/$sv/$site/install
+       site=${cmd##*/"$sv"/}
+       site=${site%/install}
+# ACTION: install from ./etc/nginx/\$site/install
+       "$tool"/etc/nginx/\$site/install "$site"
+# TODO: invoke php install script /etc/php5/fpm/org/heureux-cyclage/questionnaires/install
+# ACTION: install from ./etc/nginx/org/heureux-cyclage/questionnaires
+       nginx_log_home=$("$tool"/cat sys/nginx/log/home)
+       nginx_log_user=$("$tool"/cat sys/nginx/log/user)
+       pool=$("$tool"/cat sys/php5/fpm/org/heureux-cyclage/questionnaires/user)
+       user=$("$tool"/cat sys/nginx/org/heureux-cyclage/questionnaires/user)
+       home=$("$tool"/cat sys/nginx/org/heureux-cyclage/questionnaires/home)
+       "$tool"/ssh-sudo \
+               install -D -d -m 2750 -o "$nginx_log_user" -g "$nginx_log_user" \
+                "$nginx_log_home"/"$site"/tls
+       "$tool"/ssh-sudo adduser "$pool" "$user"
+       "$tool"/etc/mysql/user/install "$pool"
+       "$tool"/etc/mysql/database/install "$pool"
+       "$tool"/install etc/nginx/org/heureux-cyclage/questionnaires
diff --git a/srv/ateliers/etc/nginx/org/heureux-cyclage/questionnaires/server.conf.m4 b/srv/ateliers/etc/nginx/org/heureux-cyclage/questionnaires/server.conf.m4
new file mode 100644 (file)
index 0000000..b97fba6
--- /dev/null
@@ -0,0 +1,18 @@
+define(`DOMAIN',`org/heureux-cyclage')dnl
+define(`SITE',`DOMAIN/questionnaires')dnl
+server {
+       listen 443;
+       include /etc/nginx/SITE/common.conf;
+       include /etc/nginx/conf.d/ssl-pfs.conf;
+       ssl_certificate        /etc/nginx/DOMAIN/crt.pem;
+       ssl_certificate_key    /etc/nginx/DOMAIN/key.pem;
+       access_log /home/www/log/SITE/tls/access.log main;
+       error_log  /home/www/log/SITE/tls/error.log warn;
+}
+server {
+       listen 80;
+       server_name
+        questionnaires.heureux-cyclage.org;
+       
+       return 301 https://$host$request_uri;
+ }
diff --git a/srv/ateliers/etc/php5/fpm/org/heureux-cyclage/questionnaires/... b/srv/ateliers/etc/php5/fpm/org/heureux-cyclage/questionnaires/...
new file mode 120000 (symlink)
index 0000000..951b30d
--- /dev/null
@@ -0,0 +1 @@
+../...
\ No newline at end of file
diff --git a/srv/ateliers/etc/php5/fpm/org/heureux-cyclage/questionnaires/install b/srv/ateliers/etc/php5/fpm/org/heureux-cyclage/questionnaires/install
new file mode 120000 (symlink)
index 0000000..a5c2ecf
--- /dev/null
@@ -0,0 +1 @@
+.../lib/tool/admin/etc/php5/fpm/$pool/install
\ No newline at end of file
diff --git a/srv/ateliers/etc/php5/fpm/org/heureux-cyclage/questionnaires/php-fpm.conf.m4 b/srv/ateliers/etc/php5/fpm/org/heureux-cyclage/questionnaires/php-fpm.conf.m4
new file mode 100644 (file)
index 0000000..13beb1e
--- /dev/null
@@ -0,0 +1,39 @@
+define(`POOL',patsubst(__file__,`^.*/fpm/\(.*\)/[^/]*$',`\1'))dnl
+[POOL]
+access.log = CAT(sys/php5/fpm/POOL/log/home)/access.log
+catch_workers_output = no
+chdir = /
+env[HOSTNAME] = $HOSTNAME
+env[TEMP] = /tmp
+env[TMPDIR] = /tmp
+env[TMP] = /tmp
+group = CAT(sys/php5/fpm/POOL/user)
+#listen = 127.0.0.1:9000
+#listen.allowed_clients = 127.0.0.1
+#listen.owner = www-data
+listen = CAT(sys/php5/fpm/POOL/socket)
+listen.backlog = -1
+listen.group = CAT(sys/nginx/user)
+listen.mode = 0660
+php_admin_value[extension] = pdo_mysql.so
+php_value[allow_url_fopen] = On
+ping.path = /ping
+pm = dynamic
+pm.max_children = 15
+pm.max_requests = 200
+pm.max_spare_servers = 5
+pm.min_spare_servers = 1
+pm.process_idle_timeout = 60s
+pm.start_servers = 1
+pm.status_path = /status
+request_slowlog_timeout = 5s
+request_slowlog_timeout = 5s
+request_terminate_timeout = 120s
+request_terminate_timeout = 120s
+rlimit_core = unlimited
+rlimit_core = unlimited
+rlimit_files = 131072
+rlimit_files = 131072
+security.limit_extensions = .php
+slowlog = CAT(sys/php5/fpm/POOL/log/home)/slow.log
+user = CAT(sys/php5/fpm/POOL/user)
diff --git a/srv/ateliers/sys/nginx/org/heureux-cyclage/questionnaires/... b/srv/ateliers/sys/nginx/org/heureux-cyclage/questionnaires/...
new file mode 120000 (symlink)
index 0000000..951b30d
--- /dev/null
@@ -0,0 +1 @@
+../...
\ No newline at end of file
diff --git a/srv/ateliers/sys/nginx/org/heureux-cyclage/questionnaires/home b/srv/ateliers/sys/nginx/org/heureux-cyclage/questionnaires/home
new file mode 100644 (file)
index 0000000..7f1fc44
--- /dev/null
@@ -0,0 +1 @@
+/home/www/data/org/heureux-cyclage/questionnaires
\ No newline at end of file
diff --git a/srv/ateliers/sys/nginx/org/heureux-cyclage/questionnaires/user b/srv/ateliers/sys/nginx/org/heureux-cyclage/questionnaires/user
new file mode 100644 (file)
index 0000000..b37cc2b
--- /dev/null
@@ -0,0 +1 @@
+www-lhc-questionnaires
\ No newline at end of file
diff --git a/srv/ateliers/sys/php5/fpm/org/heureux-cyclage/questionnaires/... b/srv/ateliers/sys/php5/fpm/org/heureux-cyclage/questionnaires/...
new file mode 120000 (symlink)
index 0000000..951b30d
--- /dev/null
@@ -0,0 +1 @@
+../...
\ No newline at end of file
diff --git a/srv/ateliers/sys/php5/fpm/org/heureux-cyclage/questionnaires/home b/srv/ateliers/sys/php5/fpm/org/heureux-cyclage/questionnaires/home
new file mode 100644 (file)
index 0000000..6ad2d91
--- /dev/null
@@ -0,0 +1 @@
+/etc/php5/fpm/org/heureux-cyclage/questionnaires
\ No newline at end of file
diff --git a/srv/ateliers/sys/php5/fpm/org/heureux-cyclage/questionnaires/log/... b/srv/ateliers/sys/php5/fpm/org/heureux-cyclage/questionnaires/log/...
new file mode 120000 (symlink)
index 0000000..951b30d
--- /dev/null
@@ -0,0 +1 @@
+../...
\ No newline at end of file
diff --git a/srv/ateliers/sys/php5/fpm/org/heureux-cyclage/questionnaires/log/home b/srv/ateliers/sys/php5/fpm/org/heureux-cyclage/questionnaires/log/home
new file mode 100644 (file)
index 0000000..d47aabc
--- /dev/null
@@ -0,0 +1 @@
+/home/www/log/php5/fpm/org/heureux-cyclage/questionnaires
\ No newline at end of file
diff --git a/srv/ateliers/sys/php5/fpm/org/heureux-cyclage/questionnaires/socket b/srv/ateliers/sys/php5/fpm/org/heureux-cyclage/questionnaires/socket
new file mode 100644 (file)
index 0000000..2f28906
--- /dev/null
@@ -0,0 +1 @@
+/run/php5/fpm/lhc_quest
\ No newline at end of file
diff --git a/srv/ateliers/sys/php5/fpm/org/heureux-cyclage/questionnaires/user b/srv/ateliers/sys/php5/fpm/org/heureux-cyclage/questionnaires/user
new file mode 100644 (file)
index 0000000..022366b
--- /dev/null
@@ -0,0 +1 @@
+php_lhc_quest
\ No newline at end of file