dou7466 2019-06-20 11:34 采纳率: 0%
浏览 165
已采纳

如何在Symfony 4本地Web服务器上启用HTTPS

I'm working on Symfony 4 project locally using symfony local web server. How to enable HTTPS locally?

  1. In docs https://symfony.com/doc/current/setup/symfony_server.html#enabling-tls said to use "symfony server:ca:install" command, but I get a error message:

There are no commands defined in the "server:ca" namespace. Did you mean one of these?

doctrine:cache

server

  1. Then I found https://symfony.com/doc/current/security/force_https.html and tried to add

    - { path: ^/, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https }
    

and clear cache after all. But now it redirected from http://127.0.0.1:8000 to https://127.0.0.1/ with no access to the site

So what is the correct way to configure https?

The main reason to enable https is I want to configure sign in with Facebook, but Facebook demands https connection. So I cannot test it. Or, if you know the way to test sign in with Facebook without https - it would be the best decision!)

Thank you in advance and have a good day who read it!)

  • 写回答

1条回答 默认 最新

  • dt3358 2019-06-20 11:44
    关注

    You probably do not run symfony command correctly, or maybe you have some weird symbolic links. Here is a sample output for my system:

    $ symfony server:ca:install
    
     [OK] The local Certificate Authority is installed and trusted                                                          
    
    

    And what you quote as output looks more like bin/console response.

    FYI, symfony console command can be downloaded here: http://symfony.com/download

    And re your 2nd point, that configuration is valid but it does not enable HTTPS, it only ensures that certain URLs have protocol requirements.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于温度改变石墨烯介电性能(关键词-介电常数)
  • ¥150 HDMI分路器LT86102 的输出在890MHz频点处EMC超标8DB
  • ¥15 druid(相关搜索:数据库|防火墙)
  • ¥15 大一python作业
  • ¥15 preLaunchTask"C/C++: aarch64- apple-darwin22-g++-14 生成活动 文件”已终止,退出代码为-1。
  • ¥60 如何鉴定微信小程序数据被篡改过
  • ¥18 关于#贝叶斯概率#的问题:这篇文章中利用em算法求出了对数似然值作为概率表参数,然后进行概率表计算,这个概率表是怎样计算的呀
  • ¥20 C#上传XML格式数据
  • ¥15 elementui上传结合oss接口断点续传,现在只差停止上传和继续上传,各大精英看下
  • ¥20 手机截图相片分辨率降低一半