PHPackages                             ryoluo/sail-ssl - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [DevOps &amp; Deployment](/categories/devops)
4. /
5. ryoluo/sail-ssl

ActiveLibrary[DevOps &amp; Deployment](/categories/devops)

ryoluo/sail-ssl
===============

Laravel Sail plugin to enable SSL (HTTPS) connection with Nginx.

v1.5.0(4mo ago)192775.1k↓40%242MITPHPPHP ^7.3|^8.0CI passing

Since Jun 7Pushed 4mo ago2 watchersCompare

[ Source](https://github.com/ryoluo/sail-ssl)[ Packagist](https://packagist.org/packages/ryoluo/sail-ssl)[ RSS](/packages/ryoluo-sail-ssl/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (10)Dependencies (7)Versions (14)Used By (2)

Sail-SSL
========

[](#sail-ssl)

[![Version](https://camo.githubusercontent.com/f6816313931e55e8d5bf0137d395d889b10c4706f0d9770ebe02dd2316387d16/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f72796f6c756f2f7361696c2d73736c)](https://camo.githubusercontent.com/f6816313931e55e8d5bf0137d395d889b10c4706f0d9770ebe02dd2316387d16/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f72796f6c756f2f7361696c2d73736c)[![Downloads](https://camo.githubusercontent.com/7f263c337c2d4c01d93710bc46fccdef7e0f644002b0d6827d1014d7b13a39ed/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72796f6c756f2f7361696c2d73736c)](https://camo.githubusercontent.com/7f263c337c2d4c01d93710bc46fccdef7e0f644002b0d6827d1014d7b13a39ed/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72796f6c756f2f7361696c2d73736c)[![License](https://camo.githubusercontent.com/520a12adc337bc631cd54b550224970c13705aeba85b8e4d001d422532d5f762/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f72796f6c756f2f7361696c2d73736c)](https://camo.githubusercontent.com/520a12adc337bc631cd54b550224970c13705aeba85b8e4d001d422532d5f762/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f72796f6c756f2f7361696c2d73736c)[![Test](https://camo.githubusercontent.com/a83e9a5feaad7035b9f26f2aa1dee2e2ec9f171c9135600048177e6d5967ed2b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f72796f6c756f2f7361696c2d73736c2f6c61726176656c2e796d6c3f6272616e63683d6d61696e266c6162656c3d74657374)](https://camo.githubusercontent.com/a83e9a5feaad7035b9f26f2aa1dee2e2ec9f171c9135600048177e6d5967ed2b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f72796f6c756f2f7361696c2d73736c2f6c61726176656c2e796d6c3f6272616e63683d6d61696e266c6162656c3d74657374)

A [Laravel Sail](https://github.com/laravel/sail) plugin that enables SSL (HTTPS) for your local development environment using an Nginx reverse proxy with self-signed certificates.

Table of Contents
-----------------

[](#table-of-contents)

- [How It Works](#how-it-works)
- [Requirements](#requirements)
- [Installation](#installation)
- [Update AppServiceProvider](#update-appserviceprovider)
- [Trust the Certificate (Optional)](#trust-the-certificate-optional)
- [Environment Variables](#environment-variables)
- [Customize Nginx Configuration](#customize-nginx-configuration)
- [Troubleshooting](#troubleshooting)
- [Contributing](#contributing)
- [License](#license)

How It Works
------------

[](#how-it-works)

Sail-SSL adds an Nginx container to your Docker Compose setup that acts as an SSL-terminating reverse proxy:

```
Browser → https://localhost:443 → Nginx (SSL termination) → http://laravel.test → Laravel App

```

Running the `sail-ssl:install` command automatically adds an Nginx service to your `docker-compose.yml`. On container startup, a self-signed Root CA and server certificate are generated, enabling HTTPS access out of the box.

Requirements
------------

[](#requirements)

- [Laravel Sail](https://laravel.com/docs/sail) already set up in your project
- Docker and Docker Compose installed

Installation
------------

[](#installation)

### With Local PHP / Composer

[](#with-local-php--composer)

```
composer require ryoluo/sail-ssl --dev
php artisan sail-ssl:install
./vendor/bin/sail up
```

### With Sail Container

[](#with-sail-container)

```
./vendor/bin/sail up -d
./vendor/bin/sail composer require ryoluo/sail-ssl --dev
./vendor/bin/sail artisan sail-ssl:install
./vendor/bin/sail down
./vendor/bin/sail up
```

Once the containers are running, you can access .

> **Note:** The `sail-ssl:install` command adds an Nginx service to your `docker-compose.yml` (or `compose.yaml`). If an `nginx` service already exists, the command will be skipped.

Update AppServiceProvider
-------------------------

[](#update-appserviceprovider)

Since the application runs behind an Nginx reverse proxy that handles SSL, Laravel needs to be configured to generate HTTPS URLs. Add `URL::forceScheme('https')` to the `boot` method of your `AppServiceProvider`:

```
use Illuminate\Support\Facades\URL;

public function boot(): void
{
    URL::forceScheme('https');
}
```

Without this setting, Laravel may generate HTTP URLs for assets, routes, etc., even though the site is served over HTTPS.

Trust the Certificate (Optional)
--------------------------------

[](#trust-the-certificate-optional)

The plugin generates a local Root CA certificate to sign the server certificate. You can import the Root CA into your browser or OS to remove the security warning.

### 1. Copy the Root CA certificate to your host machine

[](#1-copy-the-root-ca-certificate-to-your-host-machine)

```
./vendor/bin/sail cp nginx:/etc/nginx/certs/root-ca.crt .
```

### 2. Import the certificate

[](#2-import-the-certificate)

OS / BrowserSteps**Chrome**Settings &gt; Privacy and Security &gt; Security &gt; Manage certificates &gt; Authorities &gt; Import**Firefox**Settings &gt; Privacy &amp; Security &gt; Security &gt; View Certificates &gt; Authorities &gt; Import**macOS**Double-click `root-ca.crt` to open Keychain Access, then set "Always Trust"**Windows**Double-click `root-ca.crt` &gt; Install Certificate &gt; Place in "Trusted Root Certification Authorities"> **Note:** If you change `SSL_DOMAIN` or `SSL_ALT_NAME`, remove the Docker volume to regenerate certificates:
>
> ```
> docker volume rm sail-nginx
> ```

Environment Variables
---------------------

[](#environment-variables)

You can customize the behavior by setting the following environment variables in your `.env` file:

VariableDescriptionDefault`SERVER_NAME`Value for the `server_name` directive in nginx.conf`localhost``APP_SERVICE`Laravel service name defined in docker-compose.yml`laravel.test``HTTP_PORT`Nginx HTTP port (requests to this port are redirected to `SSL_PORT`)`8000``SSL_PORT`Nginx HTTPS port`443``SSL_DOMAIN`Common Name (CN) for the SSL certificate (e.g. `*.mydomain.test`). Set this when using a domain other than `localhost``localhost``SSL_ALT_NAME`Subject Alternative Name (SAN) for the SSL certificate (e.g. `DNS:localhost,DNS:mydomain.test`). Set this when using a domain other than `localhost``DNS:localhost`### Custom Domain Example

[](#custom-domain-example)

To access your app via `mydomain.test`, add the following to your `.env`:

```
SERVER_NAME=mydomain.test
SSL_DOMAIN=mydomain.test
SSL_ALT_NAME=DNS:mydomain.test,DNS:localhost
```

Then add an entry to your hosts file (`/etc/hosts` on macOS/Linux, `C:\Windows\System32\drivers\etc\hosts` on Windows):

```
127.0.0.1 mydomain.test

```

Customize Nginx Configuration
-----------------------------

[](#customize-nginx-configuration)

You can publish the default Nginx configuration template to your project for customization:

```
php artisan sail-ssl:publish
```

This copies `default.conf.template` to `./nginx/templates/` in your project root and automatically updates the volume mount in `docker-compose.yml`.

You can use environment variables such as `${SERVER_NAME}` and `${APP_SERVICE}` directly in the template file.

Troubleshooting
---------------

[](#troubleshooting)

### Port Conflicts

[](#port-conflicts)

If `SSL_PORT` or `HTTP_PORT` conflicts with another service, change them in your `.env`:

```
HTTP_PORT=8080
SSL_PORT=4443
```

### Regenerate Certificates

[](#regenerate-certificates)

Remove the Docker volume and restart the containers:

```
docker volume rm sail-nginx
./vendor/bin/sail up
```

### Assets or Links Generated with HTTP

[](#assets-or-links-generated-with-http)

Make sure you have configured `URL::forceScheme('https')` in your `AppServiceProvider`. See [Update AppServiceProvider](#update-appserviceprovider) for details.

Contributing
------------

[](#contributing)

Pull requests are welcome! For bug reports and feature requests, please open an [Issue](https://github.com/ryoluo/sail-ssl/issues).

License
-------

[](#license)

[MIT License](LICENSE)

###  Health Score

58

—

FairBetter than 98% of packages

Maintenance76

Regular maintenance activity

Popularity56

Moderate usage in the ecosystem

Community25

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 71.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~135 days

Recently: every ~177 days

Total

11

Last Release

132d ago

PHP version history (3 changes)v1.0.0PHP ^7.3|^8.0

v1.2.0PHP ^7.3|^8.0|^8.1|^8.2

v1.3.1PHP ^7.3|^8.0|^8.1|^8.2|^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/525b954048abe70142c7ea33f27bb7407b52c044015ed6142de88fb38cf7fc53?d=identicon)[ryoluo](/maintainers/ryoluo)

---

Top Contributors

[![ryoluo](https://avatars.githubusercontent.com/u/40686845?v=4)](https://github.com/ryoluo "ryoluo (41 commits)")[![devin-ai-integration[bot]](https://avatars.githubusercontent.com/in/811515?v=4)](https://github.com/devin-ai-integration[bot] "devin-ai-integration[bot] (6 commits)")[![michaelservidio](https://avatars.githubusercontent.com/u/26412832?v=4)](https://github.com/michaelservidio "michaelservidio (5 commits)")[![kasparasg](https://avatars.githubusercontent.com/u/1433383?v=4)](https://github.com/kasparasg "kasparasg (1 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (1 commits)")[![sharafat](https://avatars.githubusercontent.com/u/810435?v=4)](https://github.com/sharafat "sharafat (1 commits)")[![go0baahh](https://avatars.githubusercontent.com/u/17992629?v=4)](https://github.com/go0baahh "go0baahh (1 commits)")[![janar153](https://avatars.githubusercontent.com/u/712648?v=4)](https://github.com/janar153 "janar153 (1 commits)")

---

Tags

httpslaravellaravel-sailnginxphpssllaravelssldockernginxsail

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ryoluo-sail-ssl/health.svg)

```
[![Health](https://phpackages.com/badges/ryoluo-sail-ssl/health.svg)](https://phpackages.com/packages/ryoluo-sail-ssl)
```

###  Alternatives

[laravel/sail

Docker files for running a basic Laravel application.

1.9k205.7M1.3k](/packages/laravel-sail)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M193](/packages/laravel-ai)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77022.3M151](/packages/laravel-mcp)[propaganistas/laravel-disposable-email

Disposable email validator

6023.0M6](/packages/propaganistas-laravel-disposable-email)[tallstackui/tallstackui

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

725173.0k14](/packages/tallstackui-tallstackui)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M345](/packages/psalm-plugin-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
