php - Laravel https请求错误提示:Invalid request (Unsupported SSL request)
迷茫
迷茫 2017-04-11 09:21:26
0
1
6791

在LNMP环境中生成私有证书并配置nginx,我现在可以访问https://localhost

在laravel 路由中添加一条

Route::get('/ssl', array('https' => true, function() {
        return View('welcome');
    })
);

再启动laravel

php artisan serve

当我访问https://localhost:8000时并不成功
提示错误

[Sat Jan 21 22:33:29 2017] 127.0.0.1:43310 Invalid request (Unsupported SSL request)
[Sat Jan 21 22:33:30 2017] 127.0.0.1:43312 Invalid request (Unsupported SSL request)
[Sat Jan 21 22:33:32 2017] 127.0.0.1:43314 Invalid request (Unsupported SSL request)
[Sat Jan 21 22:33:33 2017] 127.0.0.1:43316 Invalid request (Unsupported SSL request)
[Sat Jan 21 22:33:35 2017] 127.0.0.1:43318 Invalid request (Unsupported SSL request)
[Sat Jan 21 22:33:36 2017] 127.0.0.1:43320 Invalid request (Unsupported SSL request)

我应该怎么做才能让https能够访问?
任何提示或者帮助都非常感谢!

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

Antworte allen(1)
伊谢尔伦

首先说一下为什么会报错,这是用因为php内置的web服务器仅仅用于本地测试使用,不支持ssl加密,所以使用php artisan serve来启动https服务显然是不行的。

可以使用php-fpm的方式来启动你的web服务,这样就可以支持https的访问方式了。或者是使用stunnel对http的服务进行一下包装,参考openSSL not working with PHP built-in webserver。

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!