How to edit Nginx configuration in Laravel Forge

Categorized as Laravel Forge, Laravel Tagged ,

There are basically two options to manage Nginx configuration with Laravel Fore.

1. Create custom Nginx template before adding a site

In the Servers section of the Forge panel, you should select Nginx Templates menu option, then add your custom name to the configuration file. Then, change the template file according to your needs and press Save.

You will be able to apply this customized configuration when you add a site:

2. Edit Nginx configuration file on active site

You can do the same thing on an already added site. In the Sites section, you can find Edit Files button (right top corner). Go to files and select Edit Nginx configuration. It will load the current configuration. You will also find some comments that tell you not to remove specific lines because, for example, Forge manages the SSL settings, so these settings might be overwritten if you change them manually.

Keep in mind that when you save the new configuration, this might take a moment before Forge actually places the Nginx configuration on your site because it will update the server configuration in the background.

Leave a reply

Your email address will not be published. Required fields are marked *