Mon*_*chi 4 ruby-on-rails localhost railsinstaller
我正在使用 railsinstaller
http://localhost:3000/wage
Run Code Online (Sandbox Code Playgroud)
下一页
http://localhost:3000/wage/results?hours=23
Run Code Online (Sandbox Code Playgroud)
我尝试访问
myip:3000/wage
Run Code Online (Sandbox Code Playgroud)
但它显示 ERR_CONNECTION_REFUSED
我从 ipconfig-->ipv4
是url错误还是配置问题?
您已经开始工作了,但仅适用于本地 LAN。
如果您的防火墙和机器设置允许您在 Intranet 上查看,则转到下一步:
http://api.ipify.org/> 您将看到您的公共 IP 地址。使用它来访问您的网站http://<public_address>:3000/如果它可以在内部网运行,但不能在互联网上运行,则需要在路由器中打开端口 3000 并将其转发到本地计算机。(如果您无权访问路由器设置,请让您的管理员帮助您)。
给我更多细节以获得更完整的解决方案。你使用的是什么操作系统?
编辑:
对于 Windows10,您必须确保在防火墙中打开端口3000。
要更改默认的 3000 端口,请使用:
rails server -p 8080 更改端口
rails server -b 0.0.0.0 绑定0.0.0.0地址
更新:
服务器启动时会输出到控制台,它监听的地址:端口。例子:
Listening on tcp://0.0.0.0:3000作为开发服务器,它可以设置为仅侦听本地主机请求。
要覆盖该设置,请使用:
rails server -p <3030> -b 0.0.0.0 这将侦听端口 3030 上的所有传入连接
有关 , 的更多详细信息-p,-b请参阅帮助:
$ 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: localhost
-c, --config=file Uses a custom rackup configuration.
-d, --daemon Runs server as a Daemon.
-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
-C, --[no-]dev-caching Specifies whether to perform caching in development.
true or false
-h, --help Shows this help message.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10312 次 |
| 最近记录: |