How to change default Nginx setting on Homestead Laravel Virtualbox VM

1.2k views Asked by At

I merely followed the default Laravel Homestead setup here using VirtualBox. Working great.

But I need an additional Nginx rewrite setting in my apps vhost file on the VM, something like;

location / {
   if ($request_method !~ "(POST)"){
   rewrite ....
   }

    try_files $uri $uri/ /index.php?$query_string;
}

I can add that manually to the vhost file on the VM, but it's removed every time I provision my box.

How do I make that setting automatically applied when provision my vagrant VM box.

Is there a after provision hook, so I can run a script, or is there another easy solution available?

1

There are 1 answers

1
Konstantin On BEST ANSWER

Easiest way to achieve this is editing scripts/serve.sh file, which contains server block template in block variable.