]> git.nbdom.net Git - nb.git/commitdiff
nginx
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Thu, 7 Mar 2019 02:47:59 +0000 (02:47 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Thu, 7 Mar 2019 02:47:59 +0000 (02:47 +0000)
etc/nginx/cors [new symlink]
etc/nginx/cors.conf [new file with mode: 0644]
etc/nginx/https-only.conf [new file with mode: 0644]
etc/nginx/inc [new symlink]
etc/nginx/inc/cors [deleted file]
etc/nginx/inc/https-only.conf [deleted file]
etc/nginx/php-handler-7-fpm.conf [new file with mode: 0644]

diff --git a/etc/nginx/cors b/etc/nginx/cors
new file mode 120000 (symlink)
index 0000000..30ec88a
--- /dev/null
@@ -0,0 +1 @@
+cors.conf
\ No newline at end of file
diff --git a/etc/nginx/cors.conf b/etc/nginx/cors.conf
new file mode 100644 (file)
index 0000000..65af518
--- /dev/null
@@ -0,0 +1,28 @@
+# cors
+if ($request_method = 'OPTIONS') {
+       add_header 'Access-Control-Allow-Origin' '*';
+       add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
+       #
+       # Custom headers and headers various browsers *should* be OK with but aren't
+       #
+       add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
+       #
+       # Tell client that this pre-flight info is valid for 20 days
+       #
+       add_header 'Access-Control-Max-Age' 1728000;
+       add_header 'Content-Type' 'text/plain; charset=utf-8';
+       add_header 'Content-Length' 0;
+       return 204;
+}
+if ($request_method = 'POST') {
+       add_header 'Access-Control-Allow-Origin' '*';
+       add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
+       add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
+       add_header 'Access-Control-Expose-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
+}
+if ($request_method = 'GET') {
+       add_header 'Access-Control-Allow-Origin' '*';
+       add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
+       add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
+       add_header 'Access-Control-Expose-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
+}
diff --git a/etc/nginx/https-only.conf b/etc/nginx/https-only.conf
new file mode 100644 (file)
index 0000000..519d40d
--- /dev/null
@@ -0,0 +1,11 @@
+set $_https_only 0;
+if ( $scheme = http ) { set $_https_only 1; }
+
+if ( $https_only = "") { set $https_only ""; }
+if ( $https_only != "") { set $_https_only $https_only; }
+
+if ( $scheme = https ) { set $_https_only 0; }
+# Live is behind a load balancer which do only http queries
+if ($http_x_forwarded_proto = "https") { set $_https_only 0; }
+
+if ( $_https_only = 1 ) { return 301 https://$host$request_uri; }
diff --git a/etc/nginx/inc b/etc/nginx/inc
new file mode 120000 (symlink)
index 0000000..945c9b4
--- /dev/null
@@ -0,0 +1 @@
+.
\ No newline at end of file
diff --git a/etc/nginx/inc/cors b/etc/nginx/inc/cors
deleted file mode 100644 (file)
index 65af518..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-# cors
-if ($request_method = 'OPTIONS') {
-       add_header 'Access-Control-Allow-Origin' '*';
-       add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
-       #
-       # Custom headers and headers various browsers *should* be OK with but aren't
-       #
-       add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
-       #
-       # Tell client that this pre-flight info is valid for 20 days
-       #
-       add_header 'Access-Control-Max-Age' 1728000;
-       add_header 'Content-Type' 'text/plain; charset=utf-8';
-       add_header 'Content-Length' 0;
-       return 204;
-}
-if ($request_method = 'POST') {
-       add_header 'Access-Control-Allow-Origin' '*';
-       add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
-       add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
-       add_header 'Access-Control-Expose-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
-}
-if ($request_method = 'GET') {
-       add_header 'Access-Control-Allow-Origin' '*';
-       add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
-       add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
-       add_header 'Access-Control-Expose-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
-}
diff --git a/etc/nginx/inc/https-only.conf b/etc/nginx/inc/https-only.conf
deleted file mode 100644 (file)
index 519d40d..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-set $_https_only 0;
-if ( $scheme = http ) { set $_https_only 1; }
-
-if ( $https_only = "") { set $https_only ""; }
-if ( $https_only != "") { set $_https_only $https_only; }
-
-if ( $scheme = https ) { set $_https_only 0; }
-# Live is behind a load balancer which do only http queries
-if ($http_x_forwarded_proto = "https") { set $_https_only 0; }
-
-if ( $_https_only = 1 ) { return 301 https://$host$request_uri; }
diff --git a/etc/nginx/php-handler-7-fpm.conf b/etc/nginx/php-handler-7-fpm.conf
new file mode 100644 (file)
index 0000000..062a01b
--- /dev/null
@@ -0,0 +1 @@
+upstream php-handler { server unix:///var/run/php/php7.0-fpm.sock; }