mahdiaslami / laravel-nginx
Save nginx config to your repository and dynamically generate it.
Requires
- php: ^8.0|^8.1
- illuminate/support: ^9.0
Requires (Dev)
- orchestra/testbench: ^7.0
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2025-05-01 00:13:29 UTC
README
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.