From c32faa4ad86f3c4789c4785d672f58444f3cc394 Mon Sep 17 00:00:00 2001 From: zjwmiao <1723168479@qq.com> Date: Fri, 24 Jan 2025 11:26:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20nginx=E8=BD=AC=E5=8F=91=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/euler/nginx.conf | 110 +++++++++++++++++++----------------- deploy/gauss/nginx.conf | 101 +++++++++++++++++++-------------- deploy/mindspore/nginx.conf | 101 +++++++++++++++++++-------------- 3 files changed, 177 insertions(+), 135 deletions(-) diff --git a/deploy/euler/nginx.conf b/deploy/euler/nginx.conf index b487dc7..c483597 100644 --- a/deploy/euler/nginx.conf +++ b/deploy/euler/nginx.conf @@ -52,55 +52,63 @@ http { gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/javascript application/x-httpd-php application/json; gzip_vary on; - # # openeuler - # server { - # # listen 443 ssl; - # # server_name localhost; - # # charset utf-8; - - # listen 8080; - # server_name datastat.openeuler.org; - # charset utf-8; - # limit_conn perserver 50; - # if ($request_method = 'OPTIONS') { - # return 401; - # } - - # location / { - # location /assets { - # # publish every two weeks - # expires 14d; - # add_header Cache-Control public; - # } - # location / { - # add_header Cache-Control no-cache; - # } - # root /usr/share/nginx/html/openeuler; - # index index.html; - # # error_page 404 /404.html; - # } - - - # location ~ ^/(en|zh)/(overview|detail|mobile|about) { - # try_files $uri /index.html; - # } - - # error_page 500 501 502 503 504 505 /500.html; - # error_page 401 /401.html; - # error_page 404 /404.html; - - # location = /401.html { - # root /usr/share/nginx/html; - # } - - # location = /404.html { - # root /usr/share/nginx/html; - # } - - # location = /500.html { - # root /usr/share/nginx/html; - # } - # } - - include /etc/nginx/conf.d/*.conf; + server { + # listen 443 ssl; + # server_name localhost; + # charset utf-8; + + listen 8080; + server_name datastat.openeuler.org; + charset utf-8; + limit_conn perserver 50; + if ($request_method = 'OPTIONS') { + return 401; + } + + location / { + location /assets { + # publish every two weeks + 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; + } + + location /oneid/ { + proxy_pass https://omapi.osinfra.cn; + } + + location /api-dsapi/ { + proxy_pass https://dsapi.osinfra.cn/; + } + + location /ip-api/ { + proxy_pass http://ip-api.com/json/; + } + + location ~ ^/(en|zh) { + try_files $uri /index.html; + } + + error_page 500 501 502 503 504 505 /500.html; + error_page 401 /401.html; + error_page 404 /404.html; + + location = /401.html { + root /usr/share/nginx/html; + } + + location = /404.html { + root /usr/share/nginx/html; + } + + location = /500.html { + root /usr/share/nginx/html; + } + } } \ No newline at end of file diff --git a/deploy/gauss/nginx.conf b/deploy/gauss/nginx.conf index 643e4d2..e3cc5a1 100644 --- a/deploy/gauss/nginx.conf +++ b/deploy/gauss/nginx.conf @@ -52,46 +52,63 @@ http { gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/javascript application/x-httpd-php application/json; gzip_vary on; - # # opengauss - # server { - # # listen 443 ssl; - # # server_name localhost; - # # charset utf-8; - # listen 8080; - # server_name datastat.opengauss.org; - # charset utf-8; - # limit_conn perserver 50; - # if ($request_method = 'OPTIONS') { - # return 401; - # } - # location / { - # location /opengauss/assets { - # # publish every two weeks - # expires 14d; - # add_header Cache-Control public; - # } - # location /opengauss { - # add_header Cache-Control no-cache; - # } - # root /usr/share/nginx/html/opengauss; - # index index.html; - # # error_page 404 /404.html; - # } - # location ~ ^/(en|zh)/(overview|detail|mobile|about) { - # try_files $uri /index.html; - # } - # error_page 500 501 502 503 504 505 /500.html; - # error_page 401 /401.html; - # error_page 404 /404.html; - # location = /401.html { - # root /usr/share/nginx/html; - # } - # location = /404.html { - # root /usr/share/nginx/html; - # } - # location = /500.html { - # root /usr/share/nginx/html; - # } - # } - include /etc/nginx/conf.d/*.conf; + server { + # listen 443 ssl; + # server_name localhost; + # charset utf-8; + + listen 8080; + server_name datastat.opengauss.org; + charset utf-8; + limit_conn perserver 50; + if ($request_method = 'OPTIONS') { + return 401; + } + + location / { + location /assets { + # publish every two weeks + 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; + } + + location /oneid/ { + proxy_pass https://omapi.osinfra.cn; + } + + location /api-dsapi/ { + proxy_pass https://dsapi.osinfra.cn/; + } + + location /ip-api/ { + proxy_pass http://ip-api.com/json/; + } + + location ~ ^/(en|zh) { + try_files $uri /index.html; + } + + error_page 500 501 502 503 504 505 /500.html; + error_page 401 /401.html; + error_page 404 /404.html; + + location = /401.html { + root /usr/share/nginx/html; + } + + location = /404.html { + root /usr/share/nginx/html; + } + + location = /500.html { + root /usr/share/nginx/html; + } + } } \ No newline at end of file diff --git a/deploy/mindspore/nginx.conf b/deploy/mindspore/nginx.conf index 33451f4..9e9f5bf 100644 --- a/deploy/mindspore/nginx.conf +++ b/deploy/mindspore/nginx.conf @@ -52,46 +52,63 @@ http { gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/javascript application/x-httpd-php application/json; gzip_vary on; - # # mindspore - # server { - # # listen 443 ssl; - # # server_name localhost; - # # charset utf-8; - # listen 8080; - # server_name datastat.mindspore.cn; - # charset utf-8; - # limit_conn perserver 50; - # if ($request_method = 'OPTIONS') { - # return 401; - # } - # location / { - # location /mindspore/assets { - # # publish every two weeks - # expires 14d; - # add_header Cache-Control public; - # } - # location /mindspore { - # add_header Cache-Control no-cache; - # } - # root /usr/share/nginx/html/mindspore; - # index index.html; - # # error_page 404 /404.html; - # } - # location ~ ^/(en|zh)/(overview|detail|mobile|about) { - # try_files $uri /index.html; - # } - # error_page 500 501 502 503 504 505 /500.html; - # error_page 401 /401.html; - # error_page 404 /404.html; - # location = /401.html { - # root /usr/share/nginx/html; - # } - # location = /404.html { - # root /usr/share/nginx/html; - # } - # location = /500.html { - # root /usr/share/nginx/html; - # } - # } - include /etc/nginx/conf.d/*.conf; + server { + # listen 443 ssl; + # server_name localhost; + # charset utf-8; + + listen 8080; + server_name datastat.mindspore.cn; + charset utf-8; + limit_conn perserver 50; + if ($request_method = 'OPTIONS') { + return 401; + } + + location / { + location /assets { + # publish every two weeks + 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; + } + + location /oneid/ { + proxy_pass https://omapi.osinfra.cn; + } + + location /api-dsapi/ { + proxy_pass https://dsapi.osinfra.cn/; + } + + location /ip-api/ { + proxy_pass http://ip-api.com/json/; + } + + location ~ ^/(en|zh) { + try_files $uri /index.html; + } + + error_page 500 501 502 503 504 505 /500.html; + error_page 401 /401.html; + error_page 404 /404.html; + + location = /401.html { + root /usr/share/nginx/html; + } + + location = /404.html { + root /usr/share/nginx/html; + } + + location = /500.html { + root /usr/share/nginx/html; + } + } } \ No newline at end of file -- Gitee