From 9bd34ebd815b5393cdf2fe7d2ebaf670fa43711f Mon Sep 17 00:00:00 2001 From: zjwmiao <1723168479@qq.com> Date: Sat, 15 Feb 2025 16:30:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20nginx=E3=80=81Dockerfile=E6=95=B4?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/euler/Dockerfile | 4 +- deploy/euler/nginx.conf | 23 +- deploy/gauss/Dockerfile | 4 +- deploy/gauss/nginx.conf | 20 +- deploy/lookeng/Dockerfile | 2 +- deploy/mindspore/Dockerfile | 4 +- deploy/mindspore/nginx.conf | 19 +- packages/euler/index.html | 30 +- packages/euler/src/allow_sensor/sensors.js | 511 ------------------ packages/gauss/components.d.ts | 1 + packages/gauss/index.html | 30 +- packages/gauss/src/allow_sensor/sensors.js | 509 ----------------- packages/gauss/src/components/NotFound.vue | 44 ++ packages/gauss/src/router.ts | 12 +- packages/mindspore/components.d.ts | 1 + packages/mindspore/index.html | 13 +- .../mindspore/src/components/NotFound.vue | 44 ++ packages/mindspore/src/router.ts | 11 + 18 files changed, 206 insertions(+), 1076 deletions(-) delete mode 100644 packages/euler/src/allow_sensor/sensors.js delete mode 100644 packages/gauss/src/allow_sensor/sensors.js create mode 100644 packages/gauss/src/components/NotFound.vue create mode 100644 packages/mindspore/src/components/NotFound.vue diff --git a/deploy/euler/Dockerfile b/deploy/euler/Dockerfile index eea0e84..c724bcd 100644 --- a/deploy/euler/Dockerfile +++ b/deploy/euler/Dockerfile @@ -8,8 +8,8 @@ RUN pnpm install RUN pnpm build:euler -FROM swr.cn-north-4.myhuaweicloud.com/opensourceway/openeuler/nginx:1.24.0-22.03-lts-sp1 as NginxBuilder - +FROM swr.cn-north-4.myhuaweicloud.com/opensourceway/openeuler/nginx:latest as NginxBuilder +RUN yum update -y && yum install -y pcre-devel COPY --from=Builder /home/openeuler-datastat/web/dist/openeuler /usr/share/nginx/html/ RUN chmod -R 755 /usr/share/nginx/html diff --git a/deploy/euler/nginx.conf b/deploy/euler/nginx.conf index 25bf31e..1901ebf 100644 --- a/deploy/euler/nginx.conf +++ b/deploy/euler/nginx.conf @@ -26,6 +26,7 @@ http { keepalive_requests 100; proxy_read_timeout 900; proxy_connect_timeout 60; + proxy_hide_header X-Powered-by; proxy_send_timeout 60; client_header_timeout 60; @@ -53,17 +54,26 @@ http { gzip_vary on; server { - # listen 443 ssl; - # server_name localhost; - # charset utf-8; - listen 8080; server_name datastat.openeuler.org; charset utf-8; limit_conn perserver 50; + + add_header X-XSS-Protection "1;mode=block"; + add_header X-Content-Type-Options nosniff; + add_header X-Frame-Options DENY; + add_header Strict-Transport-Security "max-age=31536000; includeSubDomains"; + add_header Cache-Control "no-cache, no-store, must-revalidate"; + add_header Pragma no-cache; + add_header Expires 0; + proxy_set_header X-Forwarded-For $http_x_real_ip; + if ($request_method = 'OPTIONS') { return 401; } + if ($request_method !~ ^(GET|POST)$) { + return 403; + } location / { location /assets { @@ -71,9 +81,6 @@ http { expires 14d; add_header Cache-Control public; } - location / { - add_header Cache-Control no-cache; - } root /usr/share/nginx/html; index index.html; # error_page 404 /404.html; @@ -101,7 +108,7 @@ http { error_page 500 501 502 503 504 505 /500.html; error_page 401 /401.html; - error_page 404 /404.html; + error_page 404 /index.html; location = /401.html { root /usr/share/nginx/html; diff --git a/deploy/gauss/Dockerfile b/deploy/gauss/Dockerfile index 81b0dbe..ad9c9fa 100644 --- a/deploy/gauss/Dockerfile +++ b/deploy/gauss/Dockerfile @@ -8,8 +8,8 @@ RUN npm install pnpm -g RUN pnpm install RUN pnpm build:gauss -FROM swr.cn-north-4.myhuaweicloud.com/opensourceway/openeuler/nginx:1.24.0-22.03-lts-sp1 as NginxBuilder - +FROM swr.cn-north-4.myhuaweicloud.com/opensourceway/openeuler/nginx:latest as NginxBuilder +RUN yum update -y && yum install -y pcre-devel COPY --from=Builder /home/opengauss-datastat/web/dist/opengauss /usr/share/nginx/html/ RUN chmod -R 755 /usr/share/nginx/html diff --git a/deploy/gauss/nginx.conf b/deploy/gauss/nginx.conf index e291814..291ef5b 100644 --- a/deploy/gauss/nginx.conf +++ b/deploy/gauss/nginx.conf @@ -26,6 +26,7 @@ http { keepalive_requests 100; proxy_read_timeout 900; proxy_connect_timeout 60; + proxy_hide_header X-Powered-by; proxy_send_timeout 60; client_header_timeout 60; @@ -61,9 +62,23 @@ http { server_name datastat.opengauss.org; charset utf-8; limit_conn perserver 50; + + add_header X-XSS-Protection "1;mode=block"; + add_header X-Content-Type-Options nosniff; + add_header X-Frame-Options DENY; + add_header Strict-Transport-Security "max-age=31536000; includeSubDomains"; + add_header Content-Seecurity-Policy "default-src 'self'"; + add_header Cache-control "no-cache, no-store, must-revalidate"; + add_header Pragma no-cache; + add_header Expires 0; + proxy_set_header X-Forwarded-For $http_x_real_ip; + if ($request_method = 'OPTIONS') { return 401; } + if ($request_method !~ ^(GET|POST)$) { + return 403; + } location / { location /assets { @@ -71,9 +86,6 @@ http { expires 14d; add_header Cache-Control public; } - location / { - add_header Cache-Control no-cache; - } root /usr/share/nginx/html; index index.html; # error_page 404 /404.html; @@ -101,7 +113,7 @@ http { error_page 500 501 502 503 504 505 /500.html; error_page 401 /401.html; - error_page 404 /404.html; + error_page 404 /index.html; location = /401.html { root /usr/share/nginx/html; diff --git a/deploy/lookeng/Dockerfile b/deploy/lookeng/Dockerfile index 9324ce4..090687e 100644 --- a/deploy/lookeng/Dockerfile +++ b/deploy/lookeng/Dockerfile @@ -8,7 +8,7 @@ RUN pnpm install RUN pnpm build:lookeng -FROM swr.cn-north-4.myhuaweicloud.com/opensourceway/openeuler/nginx:1.24.0-22.03-lts-sp1 as NginxBuilder +FROM swr.cn-north-4.myhuaweicloud.com/opensourceway/openeuler/nginx:latest as NginxBuilder COPY --from=Builder /home/openlookeng-datastat/web/dist/openlookeng /usr/share/nginx/html/ RUN chmod -R 755 /usr/share/nginx/html diff --git a/deploy/mindspore/Dockerfile b/deploy/mindspore/Dockerfile index 9793d1f..95d7d21 100644 --- a/deploy/mindspore/Dockerfile +++ b/deploy/mindspore/Dockerfile @@ -8,8 +8,8 @@ RUN pnpm install RUN pnpm build:mindspore -FROM swr.cn-north-4.myhuaweicloud.com/opensourceway/openeuler/nginx:1.24.0-22.03-lts-sp1 as NginxBuilder - +FROM swr.cn-north-4.myhuaweicloud.com/opensourceway/openeuler/nginx:latest as NginxBuilder +RUN yum update -y && yum install -y pcre-devel COPY --from=Builder /home/mindspore-datastat/web/dist/mindspore /usr/share/nginx/html/ RUN chmod -R 755 /usr/share/nginx/html diff --git a/deploy/mindspore/nginx.conf b/deploy/mindspore/nginx.conf index fd6a8e0..073057b 100644 --- a/deploy/mindspore/nginx.conf +++ b/deploy/mindspore/nginx.conf @@ -26,6 +26,7 @@ http { keepalive_requests 100; proxy_read_timeout 900; proxy_connect_timeout 60; + proxy_hide_header X-Powered-by; proxy_send_timeout 60; client_header_timeout 60; @@ -61,9 +62,22 @@ http { server_name datastat.mindspore.cn; charset utf-8; limit_conn perserver 50; + add_header X-XSS-Protection "1;mode=block"; + add_header X-Content-Type-Options nosniff; + add_header X-Frame-Options DENY; + add_header Strict-Transport-Security "max-age=31536000; includeSubDomains"; + add_header Content-Seecurity-Policy "default-src 'self'"; + add_header Cache-control "no-cache, no-store, must-revalidate"; + add_header Pragma no-cache; + add_header Expires 0; + proxy_set_header X-Forwarded-For $http_x_real_ip; + if ($request_method = 'OPTIONS') { return 401; } + if ($request_method !~ ^(GET|POST)$) { + return 403; + } location / { location /assets { @@ -71,9 +85,6 @@ http { expires 14d; add_header Cache-Control public; } - location / { - add_header Cache-Control no-cache; - } root /usr/share/nginx/html; index index.html; # error_page 404 /404.html; @@ -101,7 +112,7 @@ http { error_page 500 501 502 503 504 505 /500.html; error_page 401 /401.html; - error_page 404 /404.html; + error_page 404 /index.html; location = /401.html { root /usr/share/nginx/html; diff --git a/packages/euler/index.html b/packages/euler/index.html index 9374896..313116c 100644 --- a/packages/euler/index.html +++ b/packages/euler/index.html @@ -3,33 +3,37 @@ - + openEuler DATASTAT
-