【问题标题】:Set custom port when starting symfony local web server启动 symfony 本地 Web 服务器时设置自定义端口
【发布时间】:2019-10-23 11:36:33
【问题描述】:

我想使用在我的 .env 文件中设置的端口以symfony server:start 启动服务器。有没有办法做到这一点?

【问题讨论】:

    标签: symfony4 local-web-server


    【解决方案1】:

    对于像我一样从谷歌跌跌撞撞的人,请使用标志--port=PORTNUMBER

    例子:

    symfony server:start --port=8080
    

    php bin/console server:start --port=8080
    

    帮助页面文档是这样描述的:

    --port=value 首选 HTTP 端口 [默认:8000]

    【讨论】:

      【解决方案2】:
      php bin/console server:start --help
      

      提供你想要的信息

      Usage:
        server:start [options] [--] [<addressport>]
      
      Arguments:
        addressport            The address to listen to (can be address:port, address, or port)
      

      所以输入

      Change the default address and port by passing them as an argument:
      
      php bin/console server:start 127.0.0.1:8080
      

      【讨论】:

        猜你喜欢
        • 2014-03-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-11-03
        • 1970-01-01
        • 2019-02-07
        • 1970-01-01
        • 2013-01-14
        相关资源
        最近更新 更多