|
|
@@ -65,73 +65,7 @@ server {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-# web proginn
|
|
|
-server {
|
|
|
- listen 80;
|
|
|
- server_name {{domain}}.test.proginn.com;
|
|
|
|
|
|
- set $temp_request_id $http_x_request_id;
|
|
|
- if ($temp_request_id = "") {
|
|
|
- set $temp_request_id $request_id;
|
|
|
- }
|
|
|
- add_header 'X-Request-Id' "$temp_request_id";
|
|
|
- access_log /data/log/proginn-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 = /robots.txt {
|
|
|
- alias /code/web/norobots.txt;
|
|
|
- }
|
|
|
- location / {
|
|
|
- limit_req zone=byip burst=100;
|
|
|
- proxy_pass http://{{ip}}/;
|
|
|
- proxy_set_header Host $http_host;
|
|
|
- proxy_set_header X-Real-IP $remote_addr;
|
|
|
- proxy_set_header X-Forwarded-For $remote_addr;
|
|
|
- proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
- proxy_set_header X-Scheme $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\.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';
|
|
|
- add_header 'Content-Length' 0;
|
|
|
- add_header 'Content-Type' 'text/plain charset=UTF-8';
|
|
|
- # return 204;
|
|
|
- return 200;
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
# web rooter
|
|
|
server {
|
|
|
listen 80;
|