成功启动,在本地启动浏览器,可以进行访问 (无法从外部访问,原因是并未绑定IP)
直接使用 Ctrl + C 就可以停止此应用
如果希望从外部访问,可以进行如下配置
-b
可以绑定服务 IP
[root@h202 blog]# rails server -b 0.0.0.0
=> Booting WEBrick
=> Rails 4.2.6 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2016-04-22 13:47:39] INFO WEBrick 1.3.1
[2016-04-22 13:47:39] INFO ruby 2.3.0 (2015-12-25) [x86_64-linux]
[2016-04-22 13:47:39] INFO WEBrick::HTTPServer#start: pid=11622 port=3000
...
...
...
打开防火墙
[root@h202 ~]# netstat -ant | grep 300
tcp 0 0 127.0.0.1:3000 0.0.0.0:* LISTEN
tcp 0 0 ::1:3000 :::* LISTEN
[root@h202 ~]#
[root@h202 ~]# vim /etc/sysconfig/iptables
[root@h202 ~]# /etc/init.d/iptables reload
iptables: Trying to reload firewall rules: [ OK ]
[root@h202 ~]# iptables -L -nv | grep 3000
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:3000
[root@h202 ~]#
本文系转载,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。
本文系转载,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。