oneinstack 部署项目时,静态文件不展示

因为是静态分离的,nginx处理静态文件,所以问题就在nginx配置文件中

将对应的css,js,图片信息也使用本地代理

server {
  listen 80;
  listen [::]:80;
  server_name shopping.kingsuper.net;
  access_log off;
  index index.html index.htm index.jsp;
  root /data/wwwroot/shopping.kingsuper.net;
  
  #error_page 404 /404.html;
  #error_page 502 /502.html;
  
  location ~ .*.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
    proxy_pass http://127.0.0.1:8080;
    expires 30d;
    access_log off;
  }
  location ~ .*.(js|css)?$ {
    proxy_pass http://127.0.0.1:8080;
    expires 7d;
    access_log off;
  }
  location ~ /(.user.ini|.ht|.git|.svn|.project|LICENSE|README.md) {
    deny all;
  }
  location ~ {
    proxy_pass http://127.0.0.1:8080;
    include proxy.conf;
  }
        
}
原文地址:https://www.cnblogs.com/SeaWxx/p/12705200.html