diff --git a/Dockerfile b/Dockerfile index fb9a9f7358bddbebf938a7614a80b35ac12d23d3..c835506c055f0aba15430044b3362d096faf997b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM swr.cn-north-4.myhuaweicloud.com/opensourceway/openeuler/nginx-hugo:1.24.0-22.03-lts-sp1-0.121.1 +FROM swr.cn-north-4.myhuaweicloud.com/opensourceway/openeuler/nginx-hugo:latest RUN git config --global http.postBuffer 1048576000 && \ git config --global https.postBuffer 1048576000 @@ -9,6 +9,9 @@ COPY ./deploy/nginx.conf /etc/nginx/nginx.conf COPY ./sitemap/sitemap-en.xml ./sitemap/sitemap-zh.xml /usr/share/nginx/html/ COPY ./sitemap/51e990e4796e419eb4a6e0c35efbb50f.txt /usr/share/nginx/html/ +RUN yum update -y \ + && yum install -y pcre-devel + RUN cd /src/ && \ git clone https://gitee.com/opengauss/docs --depth=1 latest/docs && \ mkdir -p /src/website/content/zh/docs/latest && \ diff --git a/deploy/nginx.conf b/deploy/nginx.conf index 056bfbf4ce888549702a4233eda478b51a5dbd50..0784b9496e4b45441ee6d4f5d79cf90833f2f0c8 100644 --- a/deploy/nginx.conf +++ b/deploy/nginx.conf @@ -11,7 +11,6 @@ events { worker_connections 4096; } - http { include /etc/nginx/mime.types; @@ -66,21 +65,36 @@ http { server_name localhost; charset utf-8; limit_conn perserver 50; - if ($request_method = 'OPTIONS') { - return 401; + # if ($request_method = 'OPTIONS') { + # return 401; + # } + if ($request_method !~ ^(GET|POST)$) { + return 444; } - + add_header X-XSS-Protection "1; mode=block"; + add_header X-Frame-Options DENY; + add_header X-Content-Type-Options nosniff; + add_header Content-Security-Policy "script-src 'self'; object-src 'none'; frame-src 'none'"; + add_header Cache-Control "no-cache,no-store,must-revalidate"; + add_header Pragma no-cache; + add_header Expires 0; + location / { - root /usr/share/nginx/html; - index index.html index.htm; + root /usr/share/nginx/html; + index index.html index.htm; } - error_page 404 /zh/404.html; + error_page 401 402 403 404 405 406 407 413 414 /zh/404.html; + error_page 500 501 502 503 504 505 /error.html; location = /zh/404.html { root /usr/share/nginx/html; } + location = /error.html { + root /usr/share/nginx/html; + } + location /api-search/ { proxy_pass https://doc-search-opengauss.osinfra.cn/; } diff --git a/static/error.html b/static/error.html new file mode 100644 index 0000000000000000000000000000000000000000..d3ad9540943cd9d6cb3bba18b92dfcd29c10c0f7 --- /dev/null +++ b/static/error.html @@ -0,0 +1,44 @@ + + + + + + + + openEuler + + + + +
+ +

Error

+
+ + + \ No newline at end of file