ソースを参照

docker代码部署

ccf 3 年 前
コミット
8c9cdf7271
1 ファイル変更75 行追加0 行削除
  1. 75 0
      config/nginx/template/proxy.nginx.conf

+ 75 - 0
config/nginx/template/proxy.nginx.conf

@@ -587,3 +587,78 @@ server {
         }
     }
 }
+
+# web festival
+server {
+    listen 80;
+    server_name admin.test-bituni.proginn.com;
+
+    set $temp_request_id $http_x_request_id;
+    if ($temp_request_id = "") {
+        set $temp_request_id $request_id;
+    }
+    set $temp_scheme $http_x_forwarded_proto;
+    if ($temp_scheme = "") {
+        set $temp_scheme $scheme;
+    }
+    set $temp_addr $http_x_forwarded_for;
+    if ($temp_addr = "") {
+        set $temp_addr $remote_addr;
+    }
+    add_header 'X-Request-Id' "$temp_request_id";
+    access_log /data/log/jishuin-access.log proginn-logid;
+
+    if ($http_user_agent ~* (SemrushBot|python|MJ12bot|AhrefsBot|AhrefsBot|hubspot|opensiteexplorer|leiki|webmeup|DotBot|Baiduspider|spider)) {
+        return 444;
+    }
+    if ($http_referer ~* (lottery|shishissc)) {
+        return 444;
+    }
+    location / {
+        limit_req zone=byip burst=100;
+        proxy_pass http://{{ip}}/;
+        proxy_set_header Host $http_host;
+        proxy_set_header X-Real-IP  $temp_addr;
+        proxy_set_header X-Forwarded-For $temp_addr;
+        proxy_set_header X-Forwarded-Proto $temp_scheme;
+        proxy_set_header X-Scheme $temp_scheme;
+        proxy_set_header Origin $http_origin;
+        proxy_set_header X-Request-Id $temp_request_id;
+        proxy_http_version 1.1;
+
+        #=========================CORS nginx配置=============================
+        if ($http_origin ~* (https?://([^\.]+\.)*proginn\.com(:[0-9]+)?)$) {
+
+        }
+        set $cors "true";
+
+        if ($request_method = 'OPTIONS') {
+            set $cors "${cors}options";
+        }
+        if ($request_method = 'GET') {
+            set $cors "${cors}get";
+        }
+        if ($request_method = 'POST') {
+            set $cors "${cors}post";
+        }
+        if ($cors = "trueget") {
+            add_header 'Access-Control-Allow-Origin' "$http_origin";
+            add_header 'Access-Control-Allow-Credentials' 'true';
+        }
+        if ($cors = "truepost") {
+            add_header 'Access-Control-Allow-Origin' "$http_origin";
+            add_header 'Access-Control-Allow-Credentials' 'true';
+        }
+        if ($cors = "trueoptions") {
+            #add_header 'Access-Control-Allow-Origin' "$http_origin";
+            add_header 'Access-Control-Allow-Origin' '*';
+            add_header 'Access-Control-Allow-Credentials' 'true';
+            add_header 'Access-Control-Max-Age' 1728000;
+            add_header 'Access-Control-Allow-Headers' 'Authorization,Content-Type,Accept,Origin,User-Agent,DNT,Cache-Control,X-Mx-ReqToken,Keep-Alive,X-Requested-With,If-Modified-Since,X-CSRF-TOKEN,Cookie,x-xsrf-token,X-Request-Id';
+            add_header 'Content-Length' 0;
+            add_header 'Content-Type' 'text/plain charset=UTF-8';
+            # return 204;
+            return 200;
+        }
+    }
+}