filhocodes/laravel-sail-ssl-proxy
Composer 安装命令:
composer require filhocodes/laravel-sail-ssl-proxy
包简介
Somewhat easy solution to add SSL to Sail environments
README 文档
README
An easy and ready way to configure a proxy that allows you to host local projects using Laravel Sail via HTTPS.
The design of the SSL proxy was taken from https://dev.to/adrianmejias/how-to-enable-ssl-for-local-development-using-laravel-sail-and-docker-51ee. Basically, Caddy will be executed on top of the Laravel Server, and will generate a local certificate. Then you can add this certificate to your local trusted store.
Quick usage
If you don't have a local installation of PHP and Composer, you can use this alias to execute both via docker
alias sail81 = 'mkdir -p $HOME/.sail/81/.composer/ && docker run --rm -it -u "$(id -u):$(id -g)" -v $HOME/.sail/81/.composer:/.composer -v $(pwd):/opt -w /opt laravelsail/php81-composer:latest'
Then you can just prepend the commands bellow with sail81:
# Running composer sail81 composer {...} # Running an artisan command sail81 php artisan {...}
Before setting up the proxy, Laravel Sail shall already be configured in your project. Installations made using the script provided by the Laravel Documentation will already have a Laravel Sail environment. Other than that, you will need to configure it yourself. Please refer to the Laravel Sail Documentation to do so.
With your project using Laravel Sail, require this package using Composer:
composer require --dev filhocodes/laravel-sail-ssl-proxy
Then install the proxy service using the following command:
php artisan ssl-proxy:install -m # -m will write a logic into app/Http/Middleware/TrustProxies.php to trust the SSL proxy. # You may update this logic as you wish, or you can omit the option so that the file is not modified. # In either case, is recommended in development to trust the reverse proxy
After that, spin up the development environment:
./vendor/bin/sail up -d # If you are using our custom logic to trust the SSL proxy, after the containers are booted up, you may use the # following command to retrieve the SSL proxy IP (will not work on Windows): # ./vendor/bin/filhocodes-ssl-proxy-env
After your first HTTP request to the application, a certificate will be created at
docker/sail-ssl-proxy/authorities/intermediate.crt. You can then add this certificate to your trusted store. In Linux,
you may use the command ./vendor/bin/filhocodes-ssl-proxy-trust to add the certificate to the system store.
If the authorities certificates are generated, but the certificates directory is empty, this probably means that the
authorization flow was unsuccessful. This will mostly be due to the domain check. By default, we use parse the domain of
the Application URL, defined via the app.url config (and the default APP_URL environment variable). If needed, you
can publish our config and update the value via the authorized_domains config.
php artisan vendor:publish --tag=filhocodes-ssl-proxy-config
You can also set the environment variable FILHOCODES_LARAVEL_SAIL_SSL_PROXY_DEBUG=true to log the request made to the
authorization controller.
filhocodes/laravel-sail-ssl-proxy 适用场景与选型建议
filhocodes/laravel-sail-ssl-proxy 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 02 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「ssl」 「sail」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 filhocodes/laravel-sail-ssl-proxy 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 filhocodes/laravel-sail-ssl-proxy 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 filhocodes/laravel-sail-ssl-proxy 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A simple package that adds the impersonate operation for admins
Docker files for basic PHP package development
OriginPHP Socket
Enable https on Laravel sail powered apps.
A flexible FTP, SSL-FTP, and SSH-based SFTP client for PHP. This lib provides helpers that are easy to use to manage the remote files.
Run multiple Laravel Sail websites on your local environment
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-02-19