From 994fc4af4b29c8d9aaa42348099bdac4dde7756e Mon Sep 17 00:00:00 2001 From: hamid zarghami Date: Mon, 1 Jun 2026 09:06:59 +0330 Subject: [PATCH] ngnix conf --- Dockerfile | 2 +- nginx.conf | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 nginx.conf diff --git a/Dockerfile b/Dockerfile index 993fb47..54241f2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,7 +37,7 @@ RUN sed -i 's|https://dl-cdn.alpinelinux.org/alpine|https://mirror.de.velop.ir/a COPY --from=builder /build/dist /usr/share/nginx/html -# COPY --from=builder /build/nginx.con[f] /etc/nginx/conf.d/default.conf +COPY --from=builder /build/nginx.con[f] /etc/nginx/conf.d/default.conf RUN cat /etc/nginx/conf.d/default.conf EXPOSE 80 diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..d6bbd54 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,47 @@ +server { + listen 80; + server_name localhost; + root /usr/share/nginx/html; + index index.html; + + add_header X-Frame-Options "DENY" always; + add_header X-Content-Type-Options "nosniff" always; + add_header X-XSS-Protection "1; mode=block" always; + add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload" always; + # add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline';" always; + add_header Referrer-Policy "strict-origin-when-cross-origin" always; + + location /static/ { + expires 1y; + add_header Cache-Control "public, no-transform"; + } + + location / { + try_files $uri $uri/ /index.html; + expires -1; + add_header Cache-Control "no-store, no-cache, must-revalidate"; + } + + # location /health { + # access_log off; + # return 200; + # } + + location ~ /\. { + deny all; + return 403; + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + internal; + } + + gzip on; + gzip_vary on; + gzip_min_length 10240; + gzip_proxied expired no-cache no-store private auth; + gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml application/javascript; + gzip_disable "MSIE [1-6]\."; +} \ No newline at end of file