mahdiaslami/laravel-nginx

Save nginx config to your repository and dynamically generate it.

v1.0.1 2022-09-13 10:03 UTC

This package is auto-updated.

Last update: 2024-05-03 05:36:03 UTC


README

Latest Version on Packagist Total Downloads GitHub Actions

This package prepares the commands for creating Nginx config from the Blade format.

Installation

You can install the package via composer:

composer require mahdiaslami/laravel-nginx

Usage

Create .nginx directory and add config.stub file to it. this file contains the Nginx configuration for your application. if you use a variable inside it you should prepare it inside .env file with NGINX_ prefix.

for example:

// .nginx/config.stub
server {
    root {{ $variable }};
}
// .env
NGINX_VARIABLE=/path/

You can use as many variables as you need. and use all blade directives. it will be rendered by the blade.

For publish your config into /etc/nginx/sites-available/ directory use following command. and if you only want to see configuration after render use --show option

$ php artisan nginx:publish

To create a symbolic link in the /etc/nginx/sites-enabled directory use the following command.

$ php artisan nginx:link

Set the name of the file in the sites-available directory by evaluating the NGINX_FILENAME variable in the .env directory.

Changelog

Please see CHANGELOG for more information what has changed recently.

Security

If you discover any security related issues, please email mahdyaslami@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.