Skip to content

Instantly share code, notes, and snippets.

@obfuscode
Last active November 27, 2020 09:46
Show Gist options
  • Save obfuscode/7e63a3b220bf63e99b43 to your computer and use it in GitHub Desktop.
Save obfuscode/7e63a3b220bf63e99b43 to your computer and use it in GitHub Desktop.
Maintain custom nginx config after provisioning homestead

NOTE: This is not my solution. I'm merely adding it here for my own future reference and so it could help someone else down the line.

Edit your homestead serve file:
~/.composer/vendor/laravel/homestead/scripts/serve.sh

Above the line that says:
location ~.php$ {

Add this code:
include /etc/nginx/conf.d/$1-custom;

Near the bottom of the file before this line:
service nginx restart

Add this line:
touch "/etc/nginx/conf.d/$1-custom"

Re-provision the machine.
You can now store custom rewrite/config rules inside /etc/nginx/conf.d/yourdomain.com-custom and they will never get erased.

@nekrozon
Copy link

nekrozon commented Feb 27, 2019

❤️ ❤️

@asanikovich
Copy link

Now it isn't working 😢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment