<p>The best way to accomplish what you're trying to accomplish would be to utilize the <code>after.sh</code> shell script that Homestead provides. Check out <a href="https://laravel.com/docs/5.7/homestead#extending-homestead" rel="nofollow noreferrer">Extending Homestead</a> and <a href="https://nystudio107.com/blog/local-development-with-vagrant-homestead" rel="nofollow noreferrer">Local Development with Vagrant / Homestead</a></p>

CC BY-SA 4.0
2018-12-03T16:47:16.713Z
2018-12-03T16:47:16.713Z
andrew.welch
<p>I added a nginx config rewrite rule to remove static asset numbers from file names. It works great on the server config file.</p>

<pre>
    # enable static file caching
    location ~* (.+)\.(?:\d+)\.(js|css|png|jpg|jpeg|gif|webp)$ {
     try_files $uri $1.$2;
    }
</pre>

<p>However I'm now trying to use a custome serve-craft.sh on my homestead local to replace the default serve.laravel.sh. (to prevent losing my nginx config every time I do a reload --provision).</p>

<p>I'm not familiar with sh syntax and the following doesn't seem to work when I load the sh by adding a "type:craft" to my homestead.yaml
I suspect the try_files line has syntax error</p>

<p>How could I rewrite this in shell script?</p>

<p>Any idea anyone?</p>

<nginx>
shell script question on homestead
# shell script question on homestead

(Asked by: username_0 on 2018-12-01)

I added a nginx config rewrite rule to remove static asset numbers from file names. It works great on the server config file.

    # enable static file caching
    location ~* (.+)\.(?:\d+)\.(js|css|png|jpg|jpeg|gif|webp)$ {
     try_files $uri $1.$2;
    }

However I'm now trying to use a custome serve-craft.sh on my homestead local to replace the default serve.laravel.sh. (to prevent losing my nginx config every time I do a reload --provision).
I'm not familiar with sh syntax and the following doesn't seem to work when I load the sh by adding a "type:craft" to my homestead.yaml
I suspect the try_files line has syntax error
How could I rewrite this in shell script?
Any idea anyone?

**Tags:** nginx


---

## 1 answers

### Answer by username_1 on 2018-12-03. Score: 2

The best way to accomplish what you're trying to accomplish would be to utilize the `after.sh` shell script that Homestead provides. Check out [Extending Homestead](https://laravel.com/docs/5.7/homestead#extending-homestead) and [Local Development with Vagrant / Homestead](https://nystudio107.com/blog/local-development-with-vagrant-homestead)


---

