summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Xu <alex_y_xu@yahoo.ca>2014-01-09 16:15:01 -0500
committerAlex Xu <alex_y_xu@yahoo.ca>2014-01-09 16:15:01 -0500
commit38a8dfe75f626958a3f49b05142e31cf946b1845 (patch)
tree94a5642a1b9012020e2b1c3ae6095d62edb4a080
parentff93f8b325c8848e5eba76c508ef74a4ef6c888e (diff)
downloadhtml5ks-38a8dfe75f626958a3f49b05142e31cf946b1845.tar.xz
html5ks-38a8dfe75f626958a3f49b05142e31cf946b1845.zip
Move general conf to nginx.inc.conf
-rw-r--r--nginx.conf28
-rw-r--r--nginx.inc.conf42
2 files changed, 43 insertions, 27 deletions
diff --git a/nginx.conf b/nginx.conf
index 097c64d..7d35929 100644
--- a/nginx.conf
+++ b/nginx.conf
@@ -49,33 +49,7 @@ http {
server {
listen 8080;
root www;
- add_header Cache-Control public;
- location /dump/ {
- expires 1y;
- location ~ ^/dump/(bgm|sfx)/ { add_header X-Content-Duration "0"; }
- }
-
- location ~ ^/(css/font|js/lib|scripts)/ {
- expires 1d;
- }
-
- location / {
- if ($http_cookie !~ "warned") {
- return 301 /warn.html;
- }
- }
-
- location /setcookie.html {
- add_header Set-Cookie "warned=1; Expires=Tue, 19 Jan 2038 00:00:00 GMT; HttpOnly";
- return 301 /;
- }
-
- location /warn.html {
- break;
- }
-
- expires 5s;
- add_header X-UA-Compatible "IE=edge";
+ include nginx.inc.conf;
}
}
# vim:ft=nginx:
diff --git a/nginx.inc.conf b/nginx.inc.conf
new file mode 100644
index 0000000..b795a1c
--- /dev/null
+++ b/nginx.inc.conf
@@ -0,0 +1,42 @@
+location /json/ {
+ expires 1y;
+}
+
+location /dump/ {
+ expires 1y;
+ location ~ ^/dump/(bgm|sfx)/ { add_header X-Content-Duration "0"; }
+}
+
+location ~ ^/(css/font|js/lib)/ {
+ expires 1d;
+}
+
+location / {
+ set $warned NO;
+ if ($http_cookie ~ "warned") {
+ set $warned YES;
+ }
+ if ($args ~ "warned") {
+ set $warned YES;
+ }
+ if ($warned = NO) {
+ return 307 /warn.html;
+ }
+}
+
+location /setcookie.html {
+ add_header Set-Cookie "warned=1; Expires=Tue, 19 Jan 2038 00:00:00 GMT; HttpOnly";
+ return 301 /;
+}
+
+location /warn.html {
+ break;
+}
+
+location /robots.txt {
+ break;
+}
+
+expires 5s;
+add_header Cache-Control public;
+add_header X-UA-Compatible "IE=edge";