Ajout: etc/nginx/org/heureux-cyclage/clavette-stephanoise/...
authorLudovic CHEVALIER <ludovic.chevalier@heureux-cyclage.org>
Fri, 30 Sep 2016 09:25:50 +0000 (11:25 +0200)
committerLudovic CHEVALIER <ludovic.chevalier@heureux-cyclage.org>
Fri, 30 Sep 2016 09:25:50 +0000 (11:25 +0200)
16 files changed:
srv/ateliers/etc/nginx/org/heureux-cyclage/clavette-stephanoise/... [new symlink]
srv/ateliers/etc/nginx/org/heureux-cyclage/clavette-stephanoise/common.conf.m4 [new file with mode: 0644]
srv/ateliers/etc/nginx/org/heureux-cyclage/clavette-stephanoise/install [new file with mode: 0755]
srv/ateliers/etc/nginx/org/heureux-cyclage/clavette-stephanoise/server.conf.m4 [new file with mode: 0644]
srv/ateliers/etc/php5/fpm/org/heureux-cyclage/clavette-stephanoise/... [new symlink]
srv/ateliers/etc/php5/fpm/org/heureux-cyclage/clavette-stephanoise/install [new symlink]
srv/ateliers/etc/php5/fpm/org/heureux-cyclage/clavette-stephanoise/php-fpm.conf.m4 [new file with mode: 0644]
srv/ateliers/sys/nginx/org/heureux-cyclage/clavette-stephanoise/... [new symlink]
srv/ateliers/sys/nginx/org/heureux-cyclage/clavette-stephanoise/home [new file with mode: 0644]
srv/ateliers/sys/nginx/org/heureux-cyclage/clavette-stephanoise/user [new file with mode: 0644]
srv/ateliers/sys/php5/fpm/org/heureux-cyclage/clavette-stephanoise/... [new symlink]
srv/ateliers/sys/php5/fpm/org/heureux-cyclage/clavette-stephanoise/home [new file with mode: 0644]
srv/ateliers/sys/php5/fpm/org/heureux-cyclage/clavette-stephanoise/log/... [new symlink]
srv/ateliers/sys/php5/fpm/org/heureux-cyclage/clavette-stephanoise/log/home [new file with mode: 0644]
srv/ateliers/sys/php5/fpm/org/heureux-cyclage/clavette-stephanoise/socket [new file with mode: 0644]
srv/ateliers/sys/php5/fpm/org/heureux-cyclage/clavette-stephanoise/user [new file with mode: 0644]

diff --git a/srv/ateliers/etc/nginx/org/heureux-cyclage/clavette-stephanoise/... b/srv/ateliers/etc/nginx/org/heureux-cyclage/clavette-stephanoise/...
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/clavette-stephanoise/common.conf.m4 b/srv/ateliers/etc/nginx/org/heureux-cyclage/clavette-stephanoise/common.conf.m4
new file mode 100644 (file)
index 0000000..abfedd9
--- /dev/null
@@ -0,0 +1,56 @@
+server_name
+    clavette-stephanoise.heureux-cyclage.org;
+root /home/www/data/org/heureux-cyclage/clavette-stephanoise/www/;
+
+rewrite /wp-admin$ $scheme://$host$uri/ permanent;
+       # Add trailing slash to */wp-admin requests.
+location = /wp-admin/ {
+       return 301 /wp-admin/index.php?$args;
+ }
+location / {
+       index index.html index.htm index.php;
+       try_files $uri $uri/ /index.php?$args;
+ }
+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)(/.+)$;
+       try_files $fastcgi_script_name =404;
+               # Check for path info security issue
+       fastcgi_pass unix:CAT(sys/php5/fpm/org/heureux-cyclage/clavette-stephanoise/socket);
+ }
+# vim: ft=sh
diff --git a/srv/ateliers/etc/nginx/org/heureux-cyclage/clavette-stephanoise/install b/srv/ateliers/etc/nginx/org/heureux-cyclage/clavette-stephanoise/install
new file mode 100755 (executable)
index 0000000..236233c
--- /dev/null
@@ -0,0 +1,30 @@
+#!/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"
+# ACTION: install from ./etc/php5/fpm/org/heureux-cyclage/clavette-stephanoise/install
+       "$root"/etc/php5/fpm/org/heureux-cyclage/clavette-stephanoise/install
+# ACTION: install from ./etc/nginx/org/heureux-cyclage/clavette-stephanoise
+       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/clavette-stephanoise/user)
+       user=$("$tool"/cat sys/nginx/org/heureux-cyclage/clavette-stephanoise/user)
+       home=$("$tool"/cat sys/nginx/org/heureux-cyclage/clavette-stephanoise/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/clavette-stephanoise
diff --git a/srv/ateliers/etc/nginx/org/heureux-cyclage/clavette-stephanoise/server.conf.m4 b/srv/ateliers/etc/nginx/org/heureux-cyclage/clavette-stephanoise/server.conf.m4
new file mode 100644 (file)
index 0000000..f7181ce
--- /dev/null
@@ -0,0 +1,18 @@
+define(`DOMAIN',`org/heureux-cyclage')dnl
+define(`SITE',`DOMAIN/clavette-stephanoise')dnl
+server {
+       listen 80;
+       include /etc/nginx/conf.d/letsencrypt.conf;
+       include /etc/nginx/SITE/common.conf;
+       access_log /home/www/log/SITE/access.log main;
+       error_log  /home/www/log/SITE/error.log warn;
+ }
+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;
+}
diff --git a/srv/ateliers/etc/php5/fpm/org/heureux-cyclage/clavette-stephanoise/... b/srv/ateliers/etc/php5/fpm/org/heureux-cyclage/clavette-stephanoise/...
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/clavette-stephanoise/install b/srv/ateliers/etc/php5/fpm/org/heureux-cyclage/clavette-stephanoise/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/clavette-stephanoise/php-fpm.conf.m4 b/srv/ateliers/etc/php5/fpm/org/heureux-cyclage/clavette-stephanoise/php-fpm.conf.m4
new file mode 100644 (file)
index 0000000..f43c35f
--- /dev/null
@@ -0,0 +1,45 @@
+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 = CAT(sys/php5/fpm/POOL/socket)
+#listen.allowed_clients = 127.0.0.1
+listen.group = CAT(sys/nginx/user)
+listen.mode = 0660
+#listen.owner = www-data
+listen.backlog = -1
+ping.path = /ping
+pm = dynamic
+pm.max_children = 5
+pm.max_requests = 200
+pm.max_spare_servers = 4
+pm.min_spare_servers = 2
+pm.start_servers = 3
+pm.status_path = /status
+request_slowlog_timeout = 5s
+request_terminate_timeout = 120s
+rlimit_core = unlimited
+rlimit_files = 131072
+slowlog = CAT(sys/php5/fpm/POOL/log/home)/slow.log
+user = CAT(sys/php5/fpm/POOL/user)
+#php_admin_value[extension] = pdo_mysql.so
+php_admin_value[extension] = mysql.so
+php_value[allow_url_fopen] = On
+pm.max_children = 4
+pm.max_requests = 1000
+pm.max_spare_servers = 4
+pm.min_spare_servers = 2
+pm.process_idle_timeout = 60s
+pm.start_servers = 2
+request_slowlog_timeout = 5s
+request_terminate_timeout = 120s
+rlimit_core = unlimited
+rlimit_files = 131072
+security.limit_extensions = .php
diff --git a/srv/ateliers/sys/nginx/org/heureux-cyclage/clavette-stephanoise/... b/srv/ateliers/sys/nginx/org/heureux-cyclage/clavette-stephanoise/...
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/clavette-stephanoise/home b/srv/ateliers/sys/nginx/org/heureux-cyclage/clavette-stephanoise/home
new file mode 100644 (file)
index 0000000..2a451c3
--- /dev/null
@@ -0,0 +1 @@
+/home/www/data/org/heureux-cyclage/clavette-stephanoise
\ No newline at end of file
diff --git a/srv/ateliers/sys/nginx/org/heureux-cyclage/clavette-stephanoise/user b/srv/ateliers/sys/nginx/org/heureux-cyclage/clavette-stephanoise/user
new file mode 100644 (file)
index 0000000..7bff0d6
--- /dev/null
@@ -0,0 +1 @@
+www-lhc-clav-stephanoise
\ No newline at end of file
diff --git a/srv/ateliers/sys/php5/fpm/org/heureux-cyclage/clavette-stephanoise/... b/srv/ateliers/sys/php5/fpm/org/heureux-cyclage/clavette-stephanoise/...
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/clavette-stephanoise/home b/srv/ateliers/sys/php5/fpm/org/heureux-cyclage/clavette-stephanoise/home
new file mode 100644 (file)
index 0000000..143dd00
--- /dev/null
@@ -0,0 +1 @@
+/etc/php5/fpm/org/heureux-cyclage/clavette-stephanoise
\ No newline at end of file
diff --git a/srv/ateliers/sys/php5/fpm/org/heureux-cyclage/clavette-stephanoise/log/... b/srv/ateliers/sys/php5/fpm/org/heureux-cyclage/clavette-stephanoise/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/clavette-stephanoise/log/home b/srv/ateliers/sys/php5/fpm/org/heureux-cyclage/clavette-stephanoise/log/home
new file mode 100644 (file)
index 0000000..4788fba
--- /dev/null
@@ -0,0 +1 @@
+/home/www/log/php5/fpm/org/heureux-cyclage/clavette-stephanoise
\ No newline at end of file
diff --git a/srv/ateliers/sys/php5/fpm/org/heureux-cyclage/clavette-stephanoise/socket b/srv/ateliers/sys/php5/fpm/org/heureux-cyclage/clavette-stephanoise/socket
new file mode 100644 (file)
index 0000000..b6e337c
--- /dev/null
@@ -0,0 +1 @@
+/run/php5/fpm/lhc_clav_ste
\ No newline at end of file
diff --git a/srv/ateliers/sys/php5/fpm/org/heureux-cyclage/clavette-stephanoise/user b/srv/ateliers/sys/php5/fpm/org/heureux-cyclage/clavette-stephanoise/user
new file mode 100644 (file)
index 0000000..6b1d746
--- /dev/null
@@ -0,0 +1 @@
+php_lhc_clav_ste
\ No newline at end of file