• 请不要在回答技术问题时复制粘贴 AI 生成的内容
kisshere
V2EX  ›  程序员

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

  •  
  •   kisshere · Jan 30, 2015 · 3122 views
    This topic created in 4297 days ago, the information mentioned may be changed or developed.
    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 replies  •  2015-01-30 20:37:21 +08:00
    zxy
    zxy
    Jan 30, 2015❤️1
    1
    hosts
    127.0.0.1 www.example.com
    loveyu
    loveyu
    Jan 30, 2015❤️1
    2
    服务器没配DNS吧
    webjin
    webjin
    Jan 30, 2015❤️1
    3
    vi /etc/hosts
    xxx.xxx.xxx domain.xxx
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1459 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 18:08 · PVG 02:08 · LAX 10:08 · JFK 13:08
    ♥ Do have faith in what you're doing.