| 123456789101112131415161718192021222324252627282930313233343536 |
- server {
- # 根据实际需要,将端口改回成80 or 443(改为443要https证书),同时将b2b2c-multishop-h5.mall4j.com改成真正的域名, 443端口的配置参考b2b2c-api
- listen 80;
- server_name b2b2c-multishop-h5.mall4j.com;
- location / {
- # 商家端vue项目的路径存放到这里 /usr/share/nginx/html/multishop-h5
- # 1.如果是docker部署的nginx,那么这个路径是docker里面的路径,
- # 服务器上的物理路径应该是 在docker-compose下的mall4j-nginx映射下 “./nginx/html:/usr/share/nginx/html” 也就是docker-compose的相对路径下的nginx/html文件夹
- # 2. 如果是非docker部署,就是服务器的物理路径
- # 如果location是/,那么root就要对应的代码路径咯
- # 如果location是/multishop-h5,那么这个root就可以不用/multishop-h5了,也就是/usr/share/nginx/html
- root /usr/share/nginx/html/multishop-h5;
- # 如果location 是 / 那么对应的是try_files $uri $uri/ /;
- # 如果location 是 /ms 那么对应的是try_files $uri $uri/ /ms/;
- # 如果location 是 /xxx 那么对应的是try_files $uri $uri/ /xxx/;
- try_files $uri $uri/ /;
- add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
- add_header X-Frame-Options "SAMEORIGIN";
- add_header X-XSS-Protection "1; mode=block";
- add_header X-Content-Type-Options "nosniff";
- # 如果觉得有必要的话,可以增加Content-Security-Policy,不过里面的域名要自己确定增加哪些
- # add_header Content-Security-Policy "default-src 'self' wss://b2b2c-im.mall4j.com;img-src 'self' https://img.mall4j.com data: blob:; style-src 'self' 'unsafe-inline';script-src 'self' 'unsafe-inline';font-src 'self' data:;";
- # 不缓存html
- if ($uri ~* .*\.(?:html)$){
- add_header Cache-Control "no-store, no-cache";
- }
- }
- }
|