启动成功,本地启动浏览器本地磁盘d无法访问,可以访问(不能从外面访问,原因是IP没有绑定)
只需使用 Ctrl+C 即可停止此应用程序
如果要从外部访问本地磁盘d无法访问,可以如下配置
-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 300tcp 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 ~]#