Sfoglia il codice sorgente

add test-jishuin test-job

lushuncheng 5 anni fa
parent
commit
0bdbf839b6

+ 64 - 0
config/nginx/template/proginn.nginx.conf

@@ -89,9 +89,11 @@ server {
     server_name {{domain}}.test-kaifain.proginn.com;
     root /code/web/;
     index index.php;
+    
     rewrite ^/s/([a-z0-9]+)$ /kaifain/s/$1 last;
     rewrite ^/d/([a-z0-9]+)$ /kaifain/case/$1 last;
     rewrite ^/c/([a-z0-9]+)$ /kaifain/$1 last;
+    
     location / {
         if (!-e $request_filename) {
             rewrite  ^(.*)$  /index.php?s=$1  last;
@@ -145,6 +147,68 @@ server {
     }
     access_log /data/log/kafain.log proginn-logid;
 }
+# 解决方案
+server {
+    listen 80;
+    server_name {{domain}}.test-job.proginn.com;
+    root /code/web/;
+    index index.php;
+    
+    rewrite ^/d/([a-z0-9]+)$ /job/detail/$1 last;
+    
+    location / {
+        if (!-e $request_filename) {
+            rewrite  ^(.*)$  /index.php?s=$1  last;
+            break;
+        }
+    }
+    set $temp_request_id $http_x_request_id;
+    if ($temp_request_id = "") {
+        set $temp_request_id $request_id;
+    }
+
+    location ~ ^/(composer.json|composer.lock|ThinkPHP/|vendor/|src/|bin/|App/|.git) {
+        deny all;
+    }
+    location ^~ /job {
+        proxy_pass http://127.0.0.1:3000;
+        proxy_set_header Host {{domain}}.test-job.proginn.com;
+    }
+    location ^~ /user/quit {
+        proxy_pass http://127.0.0.1;
+        proxy_set_header Host {{domain}}.test.proginn.com;
+    }
+
+    location ^~ /file/proxyUpload {
+        proxy_pass http://127.0.0.1;
+        proxy_set_header Host {{domain}}.test.proginn.com;
+    }
+
+    location /ajax/getmessage {
+        proxy_pass http://127.0.0.1;
+        proxy_set_header Host {{domain}}.test.proginn.com;
+    }
+    location /api {
+        proxy_pass http://127.0.0.1;
+        proxy_set_header Host {{domain}}.test.proginn.com;
+    }
+    location ^~ /.nuxt {
+        proxy_pass http://127.0.0.1:3000;
+        proxy_set_header Host {{domain}}.test-job.proginn.com;
+    }
+    location ^~ /_nuxt {
+        proxy_pass http://127.0.0.1:3000;
+        proxy_set_header Host {{domain}}.test-job.proginn.com;
+    }
+
+    location ~ \.php$ {
+        fastcgi_pass unix:/var/run/php7-fpm.sock;
+        fastcgi_index index.php;
+        include fastcgi_params;
+        fastcgi_param SCRIPT_FILENAME $request_filename;
+    }
+    access_log /data/log/kafain.log proginn-logid;
+}
 # proginn
 server {
     listen 80;

+ 76 - 4
config/nginx/template/proxy.nginx.conf

@@ -40,7 +40,7 @@ server {
         proxy_http_version 1.1;
 
         #=========================CORS nginx配置=============================
-        if ($http_origin ~* (https?://([0-9a-z\-_]+)\.(test|test-rooter|test-jishuin|test-festival)\.proginn\.com(:[0-9]+)?)$) {
+        if ($http_origin ~* (https?://([0-9a-z\-_]+)\.(test|test-rooter|test-jishuin|test-festival|test-kaifain|test-job)\.proginn\.com(:[0-9]+)?)$) {
             set $cors "true";
         }
         if ($request_method = 'OPTIONS') {
@@ -116,7 +116,7 @@ server {
         proxy_http_version 1.1;
 
         #=========================CORS nginx配置=============================
-        if ($http_origin ~* (https?://([0-9a-z\-_]+)\.(test|test-rooter|test-jishuin|test-festival)\.proginn\.com(:[0-9]+)?)$) {
+        if ($http_origin ~* (https?://([0-9a-z\-_]+)\.(test|test-rooter|test-jishuin|test-festival|test-kaifain|test-job)\.proginn\.com(:[0-9]+)?)$) {
             set $cors "true";
         }
         if ($request_method = 'OPTIONS') {
@@ -188,7 +188,7 @@ server {
         proxy_http_version 1.1;
 
         #=========================CORS nginx配置=============================
-        if ($http_origin ~* (https?://([0-9a-z\-_]+)\.(test|test-rooter|test-jishuin|test-festival)\.proginn\.com(:[0-9]+)?)$) {
+        if ($http_origin ~* (https?://([0-9a-z\-_]+)\.(test|test-rooter|test-jishuin|test-festival|test-kaifain|test-job)\.proginn\.com(:[0-9]+)?)$) {
             set $cors "true";
         }
         if ($request_method = 'OPTIONS') {
@@ -260,7 +260,79 @@ server {
         proxy_http_version 1.1;
 
         #=========================CORS nginx配置=============================
-        if ($http_origin ~* (https?://([0-9a-z\-_]+)\.(test|test-rooter|test-jishuin|test-kaifain|test-festival)\.proginn\.com(:[0-9]+)?)$) {
+        if ($http_origin ~* (https?://([0-9a-z\-_]+)\.(test|test-rooter|test-jishuin|test-kaifain|test-festival|test-job)\.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;
+        }
+    }
+}
+# web job
+server {
+    listen 80;
+    server_name {{domain}}.test-job.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/job-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?://([0-9a-z\-_]+)\.(test|test-rooter|test-jishuin|test-kaifain|test-festival|test-job)\.proginn\.com(:[0-9]+)?)$) {
             set $cors "true";
         }
         if ($request_method = 'OPTIONS') {