简体   繁体   English

Laravel PWA 无法安装在 apache

[英]Laravel PWA not installable on apache

I create a plain laravel 8 project to test pwa by following https://infyom.com/blog/how-to-make-a-laravel-application-pwahttps://infyom.com/blog/how-to-make-a-laravel-application-pwa .我创建了一个普通的 laravel 8 项目来测试 pwa 遵循https://infyom.com/blog/how-to-make-a-laravel-application-pwa https://infyom.com/blog/how-to-make- a-laravel-应用程序-pwa

It works as expected When I run it via cmd with php artisan serve [ http://localhost/127.0.0.1:8000 ] , showing Install btn in the right side of the URL but when I try to run it on apache [ http://localhost/projectname ] (I am using Xampp), The installation btn doesn't show .它按预期工作当我通过 cmd 和php artisan serve [ http://localhost/127.0.0.1:8000 ]运行它时,在 URL 的右侧显示 Install btn 但是当我尝试在 883528349282754 [8282754] 上运行它时//localhost/projectname ] (我用的是Xampp),安装btn不显示 When i check it using Chrome Light House, it shows the following Two error messages当我使用 Chrome Light House 检查它时,它显示以下两条错误消息


Web app manifest or service worker do not meet the installability requirements 1 reason Web app manifest 或 service worker 不符合可安装性要求 1 个原因

Service worker is the technology that enables your app to use many Progressive Web App features, such as offline, add to homescreen, and push notifications. Service Worker 是使您的应用程序能够使用许多渐进式 Web 应用程序功能的技术,例如离线、添加到主屏幕和推送通知。 With proper service worker and manifest implementations, browsers can proactively prompt users to add your app to their homescreen, which can lead to higher engagement.通过适当的服务工作者和清单实现,浏览器可以主动提示用户将您的应用程序添加到他们的主屏幕,这可以带来更高的参与度。 Learn more . 了解更多

Failure reasonNo matching service worker detected.失败原因未检测到匹配的服务工作者。 You may need to reload the page, or check that the scope of the service worker for the current page encloses the scope and start URL from the manifest.您可能需要重新加载页面,或者检查当前页面的 service worker 的 scope 是否包含 scope 并从清单中启动 URL。

& &

Does not register a service worker that controls page and start_url不注册控制 page 和start_url的 service worker


Can someone please explain why this happens or how can I fix this issue?有人可以解释为什么会发生这种情况或者我该如何解决这个问题?
Thank U in advance.提前谢谢你。

Since it work correctly when running it on php artisan serve, hoping to see it run on apache servers as well.由于它在 php artisan serve 上运行时工作正常,希望看到它也能在 apache 服务器上运行。

When you use apache it's configure your project as a vhost and without port.当您使用 apache 时,它会将您的项目配置为虚拟主机且没有端口。 In order to use service workers need SSL cert on you domain.为了使用 Service Worker,您需要在您的域上获得 SSL 证书。 Also if you want work locale in Chrome you can enable your localhost adding by insecure origin as secure domains list, easiest way to test pwa, in my opnion, was using ngrok.此外,如果你想在 Chrome 中工作,你可以启用你的本地主机,通过不安全的来源添加为安全域列表,在我看来,测试 pwa 的最简单方法是使用 ngrok。 I use ngrok my all project when need test pwa in dev env.当需要在开发环境中测试 pwa 时,我使用 ngrok 我的所有项目。 Usefull links:有用的链接:

SO answer所以回答

Ngrok download下载

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 具有PWA的Laravel 5.2 - Laravel 5.2 with PWA 将Laravel转换为PWA - Convert Laravel into PWA Composer 安装 Laravel:无法将您的要求解析为一组可安装的软件包 - Composer install Laravel: Your requirements could not be resolved to an installable set of packages 无法将您的要求解析为一组可安装的软件包。 - Laravel 5.7 - Your requirements could not be resolved to an installable set of packages. - Laravel 5.7 您的要求无法解析为 laravel 5.7 中的一组可安装软件包 - Your requirements could not be resolved to an installable set of packages in laravel 5.7 您的要求无法解决为 laravel 的一组可安装软件包 - Your requirements could not be resolved to an installable set of packages for laravel 错误:无法将您的要求解析为一组可安装的软件包。 Laravel - Error: Your requirements could not be resolved to an installable set of packages. Laravel Laravel:您的要求无法解决为一组可安装的软件包 - Laravel: Your requirements could not be resolved to an installable set of packages PHP Laravel 错误 - 您的要求无法解析为一组可安装的软件包 - PHP Laravel error - Your requirements could not be resolved to an installable set of packages Laravel部署您的要求无法解决为一组可安装的软件包 - Laravel deployement Your requirements could not be resolved to an installable set of packages
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM