search

Home  >  Q&A  >  body text

ruby - 如何设置rails服务监听的ip和端口?

我最近才开始在raspberry pi 上学习rails,我只能通过ssh 链接上pi,但是rails tutorial教程里的范例是把程序监听127.0.0.1:3000,这个地址我在其它主机是无法访问的。那么请问rails是在哪里设置ip的,我想把它设置为192.168.1.100?

黄舟黄舟2926 days ago846

reply all(1)I'll reply

  • 迷茫

    迷茫2017-04-21 11:17:53

    rails -s -b 0.0.0.0

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    16

    <code>$ rails s --help

    Usage: rails server [mongrel, thin, etc] [options]

        -p, --port=port                  Runs Rails on the specified port.

                                         Default: 3000

        -b, --binding=ip                 Binds Rails to the specified ip.

                                         Default: 0.0.0.0

        -c, --config=file                Use custom rackup configuration file

        -d, --daemon                     Make server run as a Daemon.

        -u, --debugger                   Enable ruby-debugging for the server.

        -e, --environment=name           Specifies the environment to run this server under (test/development/production).

                                         Default: development

        -P, --pid=pid                    Specifies the PID file.

                                         Default: tmp/pids/server.pid

     

        -h, --help                       Show this help message.

    </code>

    reply
    0
  • Cancelreply