2014-12-31 108 views
0

我使用laravel homestad和域http://myapp.local:1050並在brwoser做工完美,但試圖調用從Appcelerator的鈦工作室這個LINL當我得到這個錯誤開發後端形式的移動應用 沒有地址的流浪漢

 
{ 
    "code": -1, 
    "error": "Unable to resolve host \"myapp.local\": No address associated with hostname", 
    "source": { 
     "_events": { 
      "disposehandle": { 
      } 
     }, 
     "allResponseHeaders": "", 
     "apiName": "Ti.Network.HTTPClient", 
     "autoEncodeUrl": true, 
     "autoRedirect": true, 
     "bubbleParent": true, 
     "connected": false, 
     "connectionType": "GET", 
     "domain": null, 
     "location": " http://myapp.local:1050/index.php?route=api%2Fsetting&api_key=XbUP6ggYuYzbpTJ7YAsqcyoMdEglHxbfPv ...", 
     "password": null, 
     "readyState": 1, 
     "responseData": null, 
     "responseText": "", 
     "responseXML": null, 
     "status": 0, 
     "statusText": null, 
     "timeout": 10000, 
     "username": null, 
     "validatesSecureCertificate": false 
    }, 
    "success": false 
}

無法解析主機\ 「myapp.local \」:沒有與主機名

相關的地址爲什麼看不到主機名myapp.local?

編輯:

Homestead.yaml文件

 
--- 
ip: "192.168.10.10" 
memory: 2048 
cpus: 1 

authorize: /Users/abdellatifhenno/.ssh/id_rsa.pub 

keys: 
    - /Users/abdellatifhenno/.ssh/id_rsa 

folders: 
    - map: /Users/abdellatifhenno/projects 
     to: /home/vagrant/Code 

sites: 

    - map: myapp.local 
     to: /home/vagrant/Code/myapp 





variables: 
    - key: APP_ENV 
     value: local 

我的機器(OSX 10.9.5)/ etc/hosts文件

<pre> 

127.0.0.1 localhost 

127.0.0.1 activate.adobe.com 
127.0.0.1 practivate.adobe.com 
127.0.0.1 ereg.adobe.com 
127.0.0.1 activate.wip3.adobe.com 
127.0.0.1 wip3.adobe.com 
127.0.0.1 3dns-3.adobe.com 
127.0.0.1 3dns-2.adobe.com 
127.0.0.1 adobe-dns.adobe.com 
127.0.0.1 adobe-dns-2.adobe.com 
127.0.0.1 adobe-dns-3.adobe.com 
127.0.0.1 ereg.wip3.adobe.com 
127.0.0.1 activate-sea.adobe.com 
127.0.0.1 wwis-dubc1-vip60.adobe.com 
127.0.0.1 activate-sjc0.adobe.com 
127.0.0.1 hl2rcv.adobe.com 

127.0.0.1 myapp.local 



255.255.255.255 broadcasthost 
::1    localhost 
fe80::1%lo0 localhost 

</pre> 
+0

,而不是** myapp.local * *使用你的系統IP地址。 – turtle

+0

@turtle你是什麼意思?我編輯帖子 –

回答

2

編輯您的應用程序的端口聽,這樣你可以使用IP地址訪問你的應用程序。

sudo vim /etc/nginx/sites-available/myapp.local 

change port 80 to 9080 for example 
save your changes 

sudo service nginx restart 

現在嘗試通過IP地址來訪問它127.0.0.1:9080

您應該能夠使用新的端口

好運來訪問你的網站

+0

偉大的工作,我只是按照你的步驟。謝謝@Anouar –