当前位置:网站首页>laravel8更新之维护模式改进
laravel8更新之维护模式改进
2020-11-08 13:07:00 【神兵小将】
原文连接:https://www.wjcms.net/archives/laravel8%E6%9B%B4%E6%96%B0%E4%B9%8B%E7%BB%B4%E6%8A%A4%E6%A8%A1%E5%BC%8F%E6%94%B9%E8%BF%9B
对php artisan down
命令进行了一些非常漂亮的改进。
在以前的版本中,为了只允许某些人访问该网站,您必须使用白名单功能,如本博文所述:
现在支持预渲染维护模式模板,并且消除了最终用户在维护模式期间遇到错误的机会。但是,为此,必须将以下行添加到您的文件中。这些行应直接放在现有常量定义下:public/index.phpLARAVEL_START
define('LARAVEL_START', microtime(true));
if (file_exists(__DIR__.'/../storage/framework/maintenance.php')) {
require __DIR__.'/../storage/framework/maintenance.php';
}
注:php artisan down --message
已被移除
如何创建自定义Laravel维护页面
使用Laravel 8,您可以拥有一个秘密,而不是使用IP白名单。要配置它,您要做的就是:
php artisan down --secret=YOUR_SECRET_HERE
确保YOUR_SECRET_HERE使用安全的弦线更换零件!
然后访问处于维护模式的网站,请访问 你的域名+/YOUR_SECRET_HERE,这将生成一个秘密cookie,使您可以像往常一样浏览该网站!
这是使您的网站处于维护模式的好方法,但是仍然允许某些人可以访问它!
该php artisan down命令的另一个很棒的补充是您可以预渲染维护页面,这样即使您运行composer update最终用户,仍然可以看到维护页面,而不是一些错误。
为此,只需运行:
php artisan down --render="errors::503"
这样,您可以进行广泛的维护,而不必担心用户看到一些奇怪的错误,而不用担心页面看起来友好。
很酷的是,您可以将标志组合在一起。例如,您可以运行以下命令以在显示的页面上添加机密并同时更改状态代码:
php artisan down --render="errors::503" --status=200 --secret=YOUR_SECRET_HERE
版权声明
本文为[神兵小将]所创,转载请带上原文链接,感谢
https://my.oschina.net/u/3380391/blog/4707666
边栏推荐
- Top 5 Chinese cloud manufacturers in 2018: Alibaba cloud, Tencent cloud, AWS, telecom, Unicom
- On monotonous stack
- 笔试面试题目:求丢失的猪
- Top 5 Chinese cloud manufacturers in 2018: Alibaba cloud, Tencent cloud, AWS, telecom, Unicom
- Flink from introduction to Zhenxiang (10. Sink data output elasticsearch)
- Python Gadgets: code conversion
- 重返全球第三,小米做对了什么?
- Written interview questions: find the smallest positive integer missing
- Flink从入门到真香(3、从集合和文件中读取数据)
- WLAN 直连(对等连接或 P2P)调研及iOS跨平台调研
猜你喜欢
Android Basics - check box
笔试面试题目:判断单链表是否有环
软件开发中如何与人协作? | 每日趣闻
如何将 PyTorch Lightning 模型部署到生产中
Enabling education innovation and reconstruction with science and technology Huawei implements education informatization
最全!阿里巴巴经济体云原生实践!(附网盘链接)
2035我们将建成这样的国家
蘑菇街电商交易平台服务架构及改造优化历程(含PPT)
Adobe media encoder /Me 2021软件安装包(附安装教程)
Flink from introduction to Zhenxiang (10. Sink data output elasticsearch)
随机推荐
后端程序员必备:分布式事务基础篇
C language I blog assignment 03
Ali! Visual computing developer's series of manuals (with internet disk link)
金融领域首个开源中文BERT预训练模型,熵简科技推出FinBERT 1.0
笔试面试题目:求缺失的最小正整数
供货紧张!苹果被曝 iPhone 12 电源芯片产能不足
华为云重大变革:Cloud&AI 升至华为第四大 BG ,火力全开
当Kubernetes遇到机密计算,看阿里巴巴如何保护容器内数据的安全!(附网盘链接)
Q & A and book giving activities of harbor project experts
蘑菇街电商交易平台服务架构及改造优化历程(含PPT)
为 Docsify 自动生成 RSS 订阅
Written interview topic: looking for the lost pig
This year's salary is 35W +! Why is the salary of Internet companies getting higher and higher?
运维人员常用到的 11 款服务器监控工具
This time Kwai tiktok is faster than shaking.
Don't look! Full interpretation of Alibaba cloud's original data lake system! (Internet disk link attached)
Stm32uberide download and install - GPIO basic configuration operation - debug (based on CMSIS DAP debug)
Ali teaches you how to use the Internet of things platform! (Internet disk link attached)
The progress bar written in Python is so wonderful~
Tight supply! Apple's iPhone 12 power chip capacity exposed