离线服务在localhost而不是服务器IP上启动 [英] ionic serve starts on localhost and not the server IP

查看:1146
本文介绍了离线服务在localhost而不是服务器IP上启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行离线服务时,我看到:

  Gulp启动任务:['sass','watch'] 
运行dev服务器:http:// localhost:8100
运行live重载服务器:http:// localhost:35729
观看:['www / ** / *','!www / lib / ** / *']
Ionic服务器命令,输入:
restart或r从根重新启动客户端应用程序
goto或g和一个url,让应用程序导航到给定url
consolelogs或c启用/禁用控制台日志输出
serverlogs或s以启用/禁用服务器日志输出
quit或q关闭服务器并退出

这意味着我无法从浏览器访问该应用程序,因为它只侦听localhost。如何将localhost更改为实际的服务器IP?



感谢

解决方案

pre> `ionic address`

提供地址列表。选择一个



例如:

  
请通过从下面的列表中输入其号码来选择要使用的地址:
1)10.0.0.9(wlan0)
2)172.16.58.1(vmnet1)
3)172.16 .16.1(vmnet8)
4)localhost
提示前的std
地址选择:


When running ionic serve I see this:

  Gulp startup tasks: [ 'sass', 'watch' ]
  Running dev server: http://localhost:8100
  Running live reload server: http://localhost:35729
  Watching : [ 'www/**/*', '!www/lib/**/*' ]
  Ionic server commands, enter:
    restart or r to restart the client app from the root
    goto or g and a url to have the app navigate to the given url
    consolelogs or c to enable/disable console log output
    serverlogs or s to enable/disable server log output
    quit or q to shutdown the server and exit

Which means I cannot access the app from a browser as its only listening for localhost. How can I change localhost to the actual server IP?

Thanks

解决方案

`ionic address`  

gives a list of address. select one

eg :

Multiple addresses available.
Please select which address to use by entering its number from the list below:
 1) 10.0.0.9 (wlan0)
 2) 172.16.58.1 (vmnet1)
 3) 172.16.16.1 (vmnet8)
 4) localhost
Std in before prompt
Address Selection:

这篇关于离线服务在localhost而不是服务器IP上启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆