V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
kisshere
V2EX  ›  程序员

AMH 配置的 lnmp 环境架设虚拟机,服务器上能用 127.0.0.1 来访问本地网站吗?

  •  
  •   kisshere · 2015-01-30 20:21:58 +08:00 · 2363 次点击
    这是一个创建于 3374 天前的主题,其中的信息可能已经有所发展或是发生改变。
    AMH配置的lnmp环境架设虚拟机,假设网址为www.example.com,现在我要用这台虚拟机上www.example.com/a.php自己来抓取自己的www.example.com/target.php这个文件,如果按常理只需在a.php中写:echo file_get_contents('www.example.com/target.php'),但这样是否会影响速度?我能否写成:echo file_get_contents('127.0.0.1/target.php'),试了下不行,求问V神们有没有好的解决办法?
    3 条回复    2015-01-30 20:37:21 +08:00
    zxy
        1
    zxy  
       2015-01-30 20:28:06 +08:00   ❤️ 1
    hosts
    127.0.0.1 www.example.com
    loveyu
        2
    loveyu  
       2015-01-30 20:35:15 +08:00   ❤️ 1
    服务器没配DNS吧
    webjin
        3
    webjin  
       2015-01-30 20:37:21 +08:00   ❤️ 1
    vi /etc/hosts
    xxx.xxx.xxx domain.xxx
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2897 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 14:03 · PVG 22:03 · LAX 07:03 · JFK 10:03
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.