Laravel Let's Encrypt Laravel Package to install Let's Encrypt SSL Certificates for customers using A NAMES. Based upon domain name used in Laravel commands and common A Name a certificate is generated and Nginx configuration file made.
All configuration files are loaded in the main config file src/config/ssl-manager.php
which can be copied to config/ssl-manager.php
.
to be added in config file:
- target_aname
- account_email
to be added in .env:
- SSL_ROOT_SITE
- SSL_SITES_DIRECTORY
- SSL_STORAGE_DIRECTORY
Installing it from the private Git repository. For composer.json should have something like:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"repositories": [
{
"type": "vcs",
"url": "[email protected]:smart48/le-ssl-laravel-package.git"
}
],
"require": {
"php": ">=5.6.4",
"appstract/laravel-opcache": "^1.1",
"imagewize/ssl-manager": "dev-master",
"stonemax/acme2": "^1.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.7"
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
.......
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true
}
}
See also this url on setting up composer packages using private git repos.
Once that is done you install it with composer.
Stonemax package will be installed automatically when you run:
composer install
Add service provider to your app:
# config/app
'providers' => [
// ...
Imagewize\SslManager\SslManagerProvider::class,
],
Publish configs and views:
php artisan vendor:publish
Configure config/ssl-manager.php
and create specified there directories.
Add to your NGINX dynamically generated site configs directory:
# /etc/nginx/nginx.conf
...
http {
...
include /path-to-app/storage/sites.d/*.conf;
}
and do sudo visudo
to allow for restart of Nginx server without password entry using sudo
# LE SSL Restart Nginx
ploi ALL = NOPASSWD: /etc/init.d/nginx
ploi as user here but could be forge or other user.
Change views at resources/views/imagewize/ssl-manager
as you need.
Run SSL controller with required privileges:
sudo php artisan queue:work --queue=ssl-manager -- redis
php artisan ssl-controller:update-certificate domain.com now true // renew certificate now without queueing*
php artisan ssl-controller:update-certificate domain.com // queue and update certificate**
- renew or true value in first command is new order, now is no queue
** update without values
now true
is only new certificate.
Note 1: You can change the queue at config/ssl-manager.php
.
Note 2: Queue mechanism is supposed to be configured.
Package has been based on Stonemax ACME2