Reputation: 5992
I am getting a familiar error message curl: (6) Couldn't resolve host 'instance.localhost'
when running this curl command:
curl -X POST -d name=/Applications/XAMPP/xamppfiles/htdocs/instance/file.mov -d name_2=/Applications/XAMPP/xamppfiles/htdocs/instance/file2.mov http://instance.localhost/backend/scripts/process.php
The message is clear inits meaning, but when I try to access the same url in a browser, the file is displayed normally.
Note that I've configured a virtual host instance
to run local machine.
To test if it is only subdomain that can't be resolved, I placed the same file in localhost/backend/scripts/process.php and curl completed request without errors.
Why would terminal fail to recognise file in subdomain but browser won't?
I am running osx Sierra.
httpd.conf:
<VirtualHost *:80>
ServerName instance.localhost
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/instance"
<Directory "/Applications/XAMPP/xamppfiles/htdocs/instance">
Require all granted
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
#DirectoryIndex index.html
</VirtualHost>
Upvotes: 0
Views: 2635
Reputation: 62
I can think about a number of reasons. The top two:
Try to resolve the name using "nslookup instance.localhost". If you are running a VM execute the command from your local terminal and from within the VM to troubleshoot.
Also if you need those "instance.localhost" to always resolve maybe you can also add it to your /etc/hosts file with an entry such as:
127.0.0.1 instance.localhost
Upvotes: 1