0
votes

I developed backend form mobile app using laravel homestad and domain is http://myapp.local:1050 and it work perfect in a brwoser , but when trying to call this linl from appcelerator titanium studio i got this error

{
    "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
} 

Unable to resolve host \"myapp.local\": No address associated with hostname

Why can not see the hostname myapp.local ?

Edit :

Homestead.yaml file

---
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

my machine (osx 10.9.5 ) /etc/hosts file

<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>
1
instead of myapp.local use your system ip address.turtle
@turtle what did you mean ? i edited the postabada henno

1 Answers

2
votes

edit the port your application listening to , this way you can access your app using the ip address.

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

change port 80 to 9080 for example 
save your changes

sudo service nginx restart

now try to access it via the ip address 127.0.0.1:9080

You should be able to access your site using the new port

GOOD LUCK