File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,7 +13,8 @@ RUN npm run build
1313FROM nginx:stable-alpine
1414
1515COPY --from=builder /app/build /usr/share/nginx/html
16+ COPY nginx.conf /etc/nginx/conf.d/default.conf
1617
1718EXPOSE 80
1819
19- CMD ["nginx" , "-g" , "daemon off;" ]
20+ CMD ["nginx" , "-g" , "daemon off;" ]
Original file line number Diff line number Diff line change 1+ server {
2+ listen 80 ;
3+ server_name _;
4+ root /usr/share/nginx/html;
5+ index index .html;
6+
7+ location / {
8+ try_files $uri $uri / /index .html;
9+ }
10+
11+ # 静态资源缓存
12+ location ~ * \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
13+ expires 1y ;
14+ add_header Cache-Control "public, immutable" ;
15+ }
16+
17+ # 安全 headers
18+ add_header X-Content-Type-Options "nosniff" always;
19+ add_header X-Frame-Options "SAMEORIGIN" always;
20+ add_header Referrer-Policy "origin-when-cross-origin" always;
21+ add_header Strict-Transport-Security "max-age=2592000" always;
22+ }
You can’t perform that action at this time.
0 commit comments