curlã«åå解決ãæä½ã§ãããªãã·ã§ã³ããã£ã¦è¶ 絶便å©ã ã£ã話
ã¹ãã³ãµã¼ãªã³ã¯
å°ãã¿ã§ãããåãã¦ç¥ã£ã¦æåããã®ã§å ±æããã¦ãã ããã
ä¾ãã°
- ãã¼ã«ã«ãµã¼ãã«æ¬çªã®ãã¡ã¤ã³ã§HTTPã¢ã¯ã»ã¹ããã
- DNS ãå¤æ´ããåã«å¤æ´å¾ã®ãã¡ã¤ã³ã§HTTPã¢ã¯ã»ã¹ããã
ã®ãããªã±ã¼ã¹ã§ãããé常 hosts ãã¡ã¤ã«ãç·¨éãã¦è§£æ±ºãããã¨ãå¤ãã¨æãã¾ãã
ä»åã¯ãªãã¨ãcurl ã使ã£ã¦ç¢ºèªããå ´åã«éãããã¡ãã¡ hosts ãç·¨éããªãã¦ãåå解決ãæä½ãããã¨ãã§ãããªãã·ã§ã³ãè¦ã¤ãã¦ãã¾ãã¾ããããã¡ãã§ãã
--resolve <host:port:address>
ããã解決ãã¦ãããããªãªãã·ã§ã³åã§ããï¼
使ãæ¹ã¯ã»ã¨ãã©è¦ãã¾ã¾ãªã®ã§ãããåå解決ããããã¡ã¤ã³&ãã¼ãã¨ã解決çµæã¨ãã¦ä½¿ç¨ããIPãæå®ããã ãã§ãã
ä¾ãã° www.google.com ã¸ã®ã¢ã¯ã»ã¹ããã¼ã«ã«ã¢ãã¬ã¹ã«åããå ´åã¯ã以ä¸ã®ããã«å®è¡ãã¾ãã
$ curl -v --resolve www.google.com:80:127.0.0.1 http://www.google.com/ * Added www.google.com:80:127.0.0.1 to DNS cache * Hostname was found in DNS cache * Trying 127.0.0.1... * Connected to www.google.com (127.0.0.1) port 80 (#0) > GET / HTTP/1.1 > User-Agent: curl/7.35.0 > Host: www.google.com > Accept: */* > < HTTP/1.1 200 OK * Server nginx is not blacklisted < Server: nginx < Date: Thu, 02 Jun 2016 08:37:29 GMT < Content-Type: text/html < Content-Length: 612 < Last-Modified: Tue, 04 Mar 2014 11:46:45 GMT < Connection: keep-alive < ETag: "5315bd25-264" < Accept-Ranges: bytes < <!DOCTYPE html> <html> <head> <title>Welcome to nginx!</title> <style> body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; } </style> </head> <body> <h1>Welcome to nginx!</h1> <p>If you see this page, the nginx web server is successfully installed and working. Further configuration is required.</p> <p>For online documentation and support please refer to <a href="http://nginx.org/">nginx.org</a>.<br/> Commercial support is available at <a href="http://nginx.com/">nginx.com</a>.</p> <p><em>Thank you for using nginx.</em></p> </body> </html> * Connection #0 to host www.google.com left intact
ç¡äºãã¼ã«ã«ã«ç«ã¦ã¦ãã Nginx ã®ã¦ã§ã«ã«ã ç»é¢ãåå¾ãããã¨ãã§ãã¾ããã
å®éã®åå解決ã§ããããã¡ããè¦ãã¨ã¡ããã¨127.0.0.1ã¨ãã¦è§£æ±ºãã¦ããã¦ãããã¨ããããã¾ãã
* Added www.google.com:80:127.0.0.1 to DNS cache * Hostname was found in DNS cache * Trying 127.0.0.1...
ãã¡ãããHost ãããã¼ã¯ www.google.com ãæå®ããã¾ãã
> Host: www.google.com