新手问题 新手請教關於端口問題

Jesse_Fan · 2017年06月28日 · 最后由 msl12 回复于 2017年07月28日 · 1457 次阅读

請問下怎麼栽 mac 下使用 rails 在 80 端口啟動服務器?

$ bundle exec rails server -h
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.

如果是 80 的话,要 sudo.

1024 以下的端口都需要 root 权限,如果只是本地调试,就用 3000 端口好了,没什么问题的。

larrylv 回复

我自己来终结下话题,rvmsudo rails s -p 80

开发环境下为何要在80端口启动服务器..

需要 登录 后方可回复, 如果你还没有账号请 注册新账号