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;    } } }

 

posted @ 2018-04-19 14:55  zhw15  阅读(319)  评论(0编辑  收藏  举报