laravel nginx下 css 和js 加载 重写规则

    server {
        listen       80;
        server_name  test.hanwen.com;  
        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
       // laravel 链接重写
            try_files $uri $uri/ /index.php?$query_string;

        index index.php index.html index.htm;
     // css js 规则 location
~ .*.(js|css)$ {   root html/dev.hanwen.com/public;     if (-f $request_filename) {       expires 1d;       break;          } }

     // img 规则 location
~ .*.(woff2|woff|ttf|gif|jpg|jpeg|png|bmp|swf)$ {    root html/dev.hanwen.com/public;    if (-f $request_filename) {      expires 1d;      break;    } } }
原文地址:https://www.cnblogs.com/zhanghanwen16/p/8882875.html