#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 365;
server_tokens off;
#gzip on;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 6;
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary on;
server {
listen 12101 default_server;
server_name localhost;
client_max_body_size 100M;
fastcgi_intercept_errors on;
error_page 403 /custom_403.html; #鑷畾涔夐敊璇〉闈?uri
location = /custom_403.html {
ssi on; # 浣縣tml鏀寔璇诲彇鍙橀噺
ssi_silent_errors on; # 榛樿鍊兼槸off锛屽紑鍚悗鍦ㄥ鐞哠SI鏂囦欢鍑洪敊鏃朵笉杈撳嚭閿欒鎻愮ず
add_header Content-Type 'text/html';
add_header X-Frame-Options 'SAMEORIGIN';
return 403 '
403 Forbidden
403 Forbidden
';
}
location / {
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary on;
# root /usr/share/nginx/html/;
root /usr/share/nginx/html/industry-18099;
# 鐢ㄤ簬閰嶅悎 browserHistory 浣跨敤
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
location ~/industry-18099/ {
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary on;
root /usr/share/nginx/html;
# 鐢ㄤ簬閰嶅悎 browserHistory 浣跨敤
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
location /api/ {
add_header 'Access-Control-Allow-Origin' $http_origin;
add_header 'Access-Control-Allow-Headers' "*";
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET,POST';
if ($request_uri ~* "captchaImage") {
add_header 'Access-Control-Allow-Origin' 'http://10.38.26.119';
}
if ($request_method = OPTIONS) {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET,POST,PUT,DELETE,PATCH';
add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range,Referer,X-Frame-Options';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
proxy_pass http://10.38.26.119:18080/; # edit test
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 600;
}
location ^~ /preview/ {
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified- Since,Keep-Alive,Origin,User-Agent,X-Requested-With' always;
proxy_pass https://video-platform.obs.cn-north-4.myhuaweicloud.com/;
}
location /apiserver/ {
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS';
proxy_pass http://10.38.26.119/api/; # M-gM-=M-^QM-eM-^EM-3M-eM-^FM-^EM-gM-=M-^QM-eM-^\M-0M-eM-^]M-^@M-gM-+M-/M-eM-^OM-#
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 600;
}
}
}