liumiaocn:~ liumiao$ export https_proxy=
liumiaocn:~ liumiao$ curl
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "">
<meta type="copyright" content="Copyright (C) 1996-2020 The Squid Software Foundation and contributors">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ERROR: The requested URL could not be retrieved</title>
<style type="text/css"><!-- 
 * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
 * Squid software is distributed under GPLv2+ license and includes
 * contributions from numerous individuals and organizations.
 * Please see the COPYING and CONTRIBUTORS files for details.

 Stylesheet for Squid Error pages
 Adapted from design by Free CSS Templates
 Released for free under a Creative Commons Attribution 2.5 License

/* Page basics */
* {
	font-family: verdana, sans-serif;

html body {
	margin: 0;
	padding: 0;
	background: #efefef;
	font-size: 12px;
	color: #1e1e1e;

/* Page displayed title area */
#titles {
	margin-left: 15px;
	padding: 10px;
	padding-left: 100px;
	background: url('/squid-internal-static/icons/SN.png') no-repeat left;

/* initial title */
#titles h1 {
	color: #000000;
#titles h2 {
	color: #000000;

/* special event: FTP success page titles */
#titles ftpsuccess {

/* Page displayed body content area */
#content {
	padding: 10px;
	background: #ffffff;

/* General text */
p {

/* error brief description */
#error p {

/* some data which may have caused the problem */
#data {

/* the error message received from the system or other software */
#sysmsg {

pre {

/* special event: FTP / Gopher directory listing */
#dirmsg {
    font-family: courier, monospace;
    color: black;
    font-size: 10pt;
#dirlisting {
    margin-left: 2%;
    margin-right: 2%;
#dirlisting tr.entry td.icon,td.filename,td.size, {
    border-bottom: groove;
#dirlisting td.size {
    width: 50px;
    text-align: right;
    padding-right: 5px;

/* horizontal lines */
hr {
	margin: 0;

/* page displayed footer area */
#footer {
	font-size: 9px;
	padding-left: 10px;

:lang(fa) { direction: rtl; font-size: 100%; font-family: Tahoma, Roya, sans-serif; float: right; }
:lang(he) { direction: rtl; }
</head><body id=ERR_DNS_FAIL>
<div id="titles">
<h2>The requested URL could not be retrieved</h2>

<div id="content">
<p>The following error was encountered while trying to retrieve the URL: <a href=""></a></p>

<blockquote id="error">
<p><b>Unable to determine IP address from host name <q></q></b></p>

<p>The DNS server returned:</p>
<blockquote id="data">
<pre>No DNS records</pre>

<p>This means that the cache was not able to resolve the hostname presented in the URL. Check if the address is correct.</p>

<p>Your cache administrator is <a href="mailto:webmaster?subject=CacheErrorInfo%20-%20ERR_DNS_FAIL&amp;body=CacheHost%3A%20localhost%0D%0AErrPage%3A%20ERR_DNS_FAIL%0D%0AErr%3A%20%5Bnone%5D%0D%0ADNS%20ErrMsg%3A%20No%20DNS%20records%0D%0ATimeStamp%3A%20Wed,%2016%20Sep%202020%2013%3A03%3A39%20GMT%0D%0A%0D%0AClientIP%3A%20192.168.31.242%0D%0A%0D%0AHTTP%20Request%3A%0D%0AGET%20%2F%20HTTP%2F1.1%0AUser-Agent%3A%20curl%2F7.64.1%0D%0AAccept%3A%20*%2F*">webmaster</a>.</p>

<div id="footer">
<p>Generated Wed, 16 Sep 2020 13:03:39 GMT by localhost (squid/4.13)</p>
<!-- ERR_DNS_FAIL -->
liumiaocn:~ liumiao$ 


错误信息提示的非常清楚:This means that the cache was not able to resolve the hostname presented in the URL. Check if the address is correct. 然后再看一下会看到如下错误信息:Unable to determine IP address from host name,所以典型的DNS错误,但是需要注意的是却不是操作系统的网络设定处的DNS设定



在如下squid的配置文件中添加8.8.8.8 和作为dns服务器

liumiaocn:~ liumiao$ grep dns /usr/local/etc/squid.conf
liumiaocn:~ liumiao$ vi /usr/local/etc/squid.conf
liumiaocn:~ liumiao$ grep dns /usr/local/etc/squid.conf
liumiaocn:~ liumiao$


liumiaocn:~ liumiao$ brew services restart squid
Stopping `squid`... (might take a while)
==> Successfully stopped `squid` (label: homebrew.mxcl.squid)
==> Successfully started `squid` (label: homebrew.mxcl.squid)
liumiaocn:~ liumiao$ 
liumiaocn:~ liumiao$ brew services list |grep squid
squid started liumiao /Users/liumiao/Library/LaunchAgents/homebrew.mxcl.squid.plist
liumiaocn:~ liumiao$ 


liumiaocn:~ liumiao$ export https_proxy=
liumiaocn:~ liumiao$ curl
<!DOCTYPE html>
<!--STATUS OK--><html> <head><meta http-equiv=content-type content=text/html;charset=utf-8><meta http-equiv=X-UA-Compatible content=IE=Edge><meta content=always name=referrer><link rel=stylesheet type=text/css href=><title>百度一下,你就知道</title></head> <body link=#0000cc> <div id=wrapper> <div id=head> <div class=head_wrapper> <div class=s_form> <div class=s_form_wrapper> <div id=lg> <img hidefocus=true src=// width=270 height=129> </div> <form id=form name=f action=// class=fm> <input type=hidden name=bdorz_come value=1> <input type=hidden name=ie value=utf-8> <input type=hidden name=f value=8> <input type=hidden name=rsv_bp value=1> <input type=hidden name=rsv_idx value=1> <input type=hidden name=tn value=baidu><span class="bg s_ipt_wr"><input id=kw name=wd class=s_ipt value maxlength=255 autocomplete=off autofocus></span><span class="bg s_btn_wr"><input type=submit id=su value=百度一下 class="bg s_btn"></span> </form> </div> </div> <div id=u1> <a href= name=tj_trnews class=mnav>新闻</a> <a href= name=tj_trhao123 class=mnav>hao123</a> <a href= name=tj_trmap class=mnav>地图</a> <a href= name=tj_trvideo class=mnav>视频</a> <a href= name=tj_trtieba class=mnav>贴吧</a> <noscript> <a href=;tpl=mn&amp; name=tj_login class=lb>登录</a> </noscript> <script>document.write('<a href="'+ encodeURIComponent(window.location.href+ ( === "" ? "?" : "&")+ "bdorz_come=1")+ '" name="tj_login" class="lb">登录</a>');</script> <a href=// name=tj_briicon class=bri style="display: block;">更多产品</a> </div> </div> </div> <div id=ftCon> <div id=ftConw> <p id=lh> <a href=>关于百度</a> <a href=>About Baidu</a> </p> <p id=cp>&copy;2017&nbsp;Baidu&nbsp;<a href=>使用百度前必读</a>&nbsp; <a href= class=cp-feedback>意见反馈</a>&nbsp;京ICP证030173号&nbsp; <img src=//> </p> </div> </div> </div> </body> </html>
liumiaocn:~ liumiao$