mall.conf.j2 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. server {
  2. listen 80;
  3. server_name mall.niusenyun.com; # 替换为您的域名
  4. access_log /var/log/nginx/mall_access.log;
  5. error_log /var/log/nginx/mall_error.log;
  6. root {{ deploy_path }}/frontendui/build/web;
  7. index index.html;
  8. # 启用gzip压缩
  9. gzip on;
  10. gzip_min_length 1k;
  11. gzip_buffers 4 16k;
  12. gzip_comp_level 6;
  13. gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
  14. gzip_vary on;
  15. location / {
  16. try_files $uri $uri/ /index.html;
  17. expires 7d;
  18. add_header Cache-Control "public, no-transform";
  19. }
  20. location /app-api/ { ## 后端项目 - 用户 App
  21. proxy_pass http://localhost:48080/app-api/; ## 重要!!!proxy_pass 需要设置为后端项目所在服务器的 IP
  22. proxy_set_header Host $http_host;
  23. proxy_set_header X-Real-IP $remote_addr;
  24. proxy_set_header REMOTE-HOST $remote_addr;
  25. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  26. }
  27. # 禁止访问隐藏文件
  28. location ~ /\. {
  29. deny all;
  30. access_log off;
  31. log_not_found off;
  32. }
  33. }