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

如何在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 用hfss做微带贴片阵列天线的时候分析设置有问题
  • ¥50 我撰写的python爬虫爬不了 要爬的网址有反爬机制
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥120 计算机网络的新校区组网设计
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等