Ajout : etc/nginx/org/cyclofficinedangouleme/www/...
authorLudovic CHEVALIER <ludovic.chevalier@heureux-cyclage.org>
Fri, 11 Sep 2015 12:11:15 +0000 (14:11 +0200)
committerLudovic CHEVALIER <ludovic.chevalier@heureux-cyclage.org>
Fri, 11 Sep 2015 12:11:15 +0000 (14:11 +0200)
21 files changed:
srv/ateliers/etc/nginx/org/cyclofficinedangouleme/... [new symlink]
srv/ateliers/etc/nginx/org/cyclofficinedangouleme/install [new file with mode: 0755]
srv/ateliers/etc/nginx/org/cyclofficinedangouleme/www/... [new symlink]
srv/ateliers/etc/nginx/org/cyclofficinedangouleme/www/common.conf.m4 [new file with mode: 0644]
srv/ateliers/etc/nginx/org/cyclofficinedangouleme/www/install [new file with mode: 0755]
srv/ateliers/etc/nginx/org/cyclofficinedangouleme/www/server.conf.m4 [new file with mode: 0644]
srv/ateliers/etc/php5/fpm/org/cyclofficinedangouleme/... [new symlink]
srv/ateliers/etc/php5/fpm/org/cyclofficinedangouleme/www/... [new symlink]
srv/ateliers/etc/php5/fpm/org/cyclofficinedangouleme/www/install [new symlink]
srv/ateliers/etc/php5/fpm/org/cyclofficinedangouleme/www/php-fpm.conf.m4 [new file with mode: 0644]
srv/ateliers/sys/nginx/org/cyclofficinedangouleme/... [new symlink]
srv/ateliers/sys/nginx/org/cyclofficinedangouleme/www/... [new symlink]
srv/ateliers/sys/nginx/org/cyclofficinedangouleme/www/home [new file with mode: 0644]
srv/ateliers/sys/nginx/org/cyclofficinedangouleme/www/user [new file with mode: 0644]
srv/ateliers/sys/php5/fpm/org/cyclofficinedangouleme/... [new symlink]
srv/ateliers/sys/php5/fpm/org/cyclofficinedangouleme/www/... [new symlink]
srv/ateliers/sys/php5/fpm/org/cyclofficinedangouleme/www/home [new file with mode: 0644]
srv/ateliers/sys/php5/fpm/org/cyclofficinedangouleme/www/log/... [new symlink]
srv/ateliers/sys/php5/fpm/org/cyclofficinedangouleme/www/log/home [new file with mode: 0644]
srv/ateliers/sys/php5/fpm/org/cyclofficinedangouleme/www/socket [new file with mode: 0644]
srv/ateliers/sys/php5/fpm/org/cyclofficinedangouleme/www/user [new file with mode: 0644]

diff --git a/srv/ateliers/etc/nginx/org/cyclofficinedangouleme/... b/srv/ateliers/etc/nginx/org/cyclofficinedangouleme/...
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/cyclofficinedangouleme/install b/srv/ateliers/etc/nginx/org/cyclofficinedangouleme/install
new file mode 100755 (executable)
index 0000000..080f9e4
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh -eu
+# SYNTAX: $path
+# DESCRIPTION: install
+
+# ACTION: initialize from ./
+       tool=$(readlink -e "${0%/install}"/...)/lib/tool/admin
+       . "$tool"/lib/install.sh
+# ACTION install ./etc/nginx/org/cyclofficinedangouleme/
+       "$tool"/ssh-sudo install -d -m 755 -o root -g root \
+        /etc/nginx/org \
+        /etc/nginx/org/cyclofficinedangouleme \
+       "$tool"/install etc/nginx/org/cyclofficinedangouleme
diff --git a/srv/ateliers/etc/nginx/org/cyclofficinedangouleme/www/... b/srv/ateliers/etc/nginx/org/cyclofficinedangouleme/www/...
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/cyclofficinedangouleme/www/common.conf.m4 b/srv/ateliers/etc/nginx/org/cyclofficinedangouleme/www/common.conf.m4
new file mode 100644 (file)
index 0000000..7a1523d
--- /dev/null
@@ -0,0 +1,57 @@
+server_name
+    www.cyclofficinedangouleme.org
+    cyclofficinedangouleme.heureux-cyclage.org;
+root /home/www/data/org/cyclofficinedangouleme/www/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/cyclofficinedangouleme/www/socket);
+ }
+# vim: ft=sh
diff --git a/srv/ateliers/etc/nginx/org/cyclofficinedangouleme/www/install b/srv/ateliers/etc/nginx/org/cyclofficinedangouleme/www/install
new file mode 100755 (executable)
index 0000000..9b16335
--- /dev/null
@@ -0,0 +1,24 @@
+#!/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/cyclofficinedangouleme/www/install
+# ACTION: install from ./etc/nginx/org/cyclofficinedangouleme/www
+       pool=$("$tool"/cat sys/php5/fpm/org/cyclofficinedangouleme/www/user)
+       user=$("$tool"/cat sys/nginx/org/cyclofficinedangouleme/www/user)
+       home=$("$tool"/cat sys/nginx/org/cyclofficinedangouleme/www/home)
+       "$tool"/ssh-sudo adduser "$pool" "$user"
+       "$tool"/etc/mysql/user/install "$pool"
+       "$tool"/etc/mysql/database/install "$pool"
+       "$tool"/install etc/nginx/org/cyclofficinedangouleme/www
diff --git a/srv/ateliers/etc/nginx/org/cyclofficinedangouleme/www/server.conf.m4 b/srv/ateliers/etc/nginx/org/cyclofficinedangouleme/www/server.conf.m4
new file mode 100644 (file)
index 0000000..d16f27b
--- /dev/null
@@ -0,0 +1,15 @@
+define(`DOMAIN',`org/cyclofficinedangouleme')dnl
+define(`SITE',`DOMAIN/www')dnl
+define(`NAME',`cyclofficinedangouleme.org')dnl
+server {
+       listen 80;
+       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 {
+       server_name
+               NAME
+       listen 80;
+       return 301 http://www.NAME$request_uri;
+}
diff --git a/srv/ateliers/etc/php5/fpm/org/cyclofficinedangouleme/... b/srv/ateliers/etc/php5/fpm/org/cyclofficinedangouleme/...
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/cyclofficinedangouleme/www/... b/srv/ateliers/etc/php5/fpm/org/cyclofficinedangouleme/www/...
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/cyclofficinedangouleme/www/install b/srv/ateliers/etc/php5/fpm/org/cyclofficinedangouleme/www/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/cyclofficinedangouleme/www/php-fpm.conf.m4 b/srv/ateliers/etc/php5/fpm/org/cyclofficinedangouleme/www/php-fpm.conf.m4
new file mode 100644 (file)
index 0000000..80d3548
--- /dev/null
@@ -0,0 +1,37 @@
+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
+#php_admin_value[extension] = pdo_mysql.so
+php_admin_value[extension] = mysql.so
+php_admin_value[extension] = curl.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.start_servers = 1
+pm.status_path = /status
+pm.process_idle_timeout = 60s
+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)
+security.limit_extensions = .php
diff --git a/srv/ateliers/sys/nginx/org/cyclofficinedangouleme/... b/srv/ateliers/sys/nginx/org/cyclofficinedangouleme/...
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/cyclofficinedangouleme/www/... b/srv/ateliers/sys/nginx/org/cyclofficinedangouleme/www/...
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/cyclofficinedangouleme/www/home b/srv/ateliers/sys/nginx/org/cyclofficinedangouleme/www/home
new file mode 100644 (file)
index 0000000..8a942ec
--- /dev/null
@@ -0,0 +1 @@
+/home/www/data/org/cyclofficinedangouleme/www
\ No newline at end of file
diff --git a/srv/ateliers/sys/nginx/org/cyclofficinedangouleme/www/user b/srv/ateliers/sys/nginx/org/cyclofficinedangouleme/www/user
new file mode 100644 (file)
index 0000000..0938c3b
--- /dev/null
@@ -0,0 +1 @@
+www-cyclang-www
\ No newline at end of file
diff --git a/srv/ateliers/sys/php5/fpm/org/cyclofficinedangouleme/... b/srv/ateliers/sys/php5/fpm/org/cyclofficinedangouleme/...
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/cyclofficinedangouleme/www/... b/srv/ateliers/sys/php5/fpm/org/cyclofficinedangouleme/www/...
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/cyclofficinedangouleme/www/home b/srv/ateliers/sys/php5/fpm/org/cyclofficinedangouleme/www/home
new file mode 100644 (file)
index 0000000..f445f8f
--- /dev/null
@@ -0,0 +1 @@
+/etc/php5/fpm/org/cyclofficinedangouleme/www
\ No newline at end of file
diff --git a/srv/ateliers/sys/php5/fpm/org/cyclofficinedangouleme/www/log/... b/srv/ateliers/sys/php5/fpm/org/cyclofficinedangouleme/www/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/cyclofficinedangouleme/www/log/home b/srv/ateliers/sys/php5/fpm/org/cyclofficinedangouleme/www/log/home
new file mode 100644 (file)
index 0000000..7f1f297
--- /dev/null
@@ -0,0 +1 @@
+/home/www/log/php5/fpm/org/cyclofficinedangouleme/www
\ No newline at end of file
diff --git a/srv/ateliers/sys/php5/fpm/org/cyclofficinedangouleme/www/socket b/srv/ateliers/sys/php5/fpm/org/cyclofficinedangouleme/www/socket
new file mode 100644 (file)
index 0000000..3f64613
--- /dev/null
@@ -0,0 +1 @@
+/run/php5/fpm/cyclang_www
\ No newline at end of file
diff --git a/srv/ateliers/sys/php5/fpm/org/cyclofficinedangouleme/www/user b/srv/ateliers/sys/php5/fpm/org/cyclofficinedangouleme/www/user
new file mode 100644 (file)
index 0000000..70311cf
--- /dev/null
@@ -0,0 +1 @@
+php_cyclang_www
\ No newline at end of file