在处理移动客户端时,在HTTP请求的传输期间具有多秒延迟是很常见的.如果您使用prefork Apache提供页面或服务,即使您的应用程序服务器逻辑在5毫秒内完成,子进程也会在几秒钟内为单个移动客户端提供服务.我正在寻找支持以下内容的HTTP服务器,平衡器或代理服务器:
请求到达代理.代理开始在RAM或磁盘中缓冲请求,包括头和POST/PUT主体.代理不会打开与后端服务器的连接.这可能是最重要的部分.
代理服务器在以下情况下停止缓冲请求:
只有现在,在内存中有(部分)请求,才会向后端打开一个连接,并且中继请求.
后端发回响应.代理服务器再次开始立即缓冲(最大尺寸,比如64KB).
由于代理具有足够大的缓冲区,因此后端响应在几毫秒内完全存储在代理服务器中,并且后端进程/线程可以自由处理更多请求.后端连接立即关闭.
代理以尽可能快或慢的速度将响应发送回移动客户端,而无需连接到后端占用资源.
我相信你可以用Squid做4-6,而nginx似乎支持1-3(在这方面看起来相当独特).我的问题是:是否有任何代理服务器能够理解这些缓冲和非开放连接直到准备好的功能?也许只有一点Apache config-fu使这个缓冲行为变得微不足道?它们中的任何一个都不像Squid这样的恐龙,它支持精益的单进程,异步,基于事件的执行模型吗?
(Siderant:我会使用nginx,但它不支持分块的POST机构,因此无法为移动客户端提供服务.是便宜的50美元手机喜欢分块的POST ...叹息)
在此文章中,有人认为,使用内存缓存如果你经常从数据库中获取随机实体,和Squid如果使用REST架构.请解释原因(关于鱿鱼).
什么命令重启Linux发行版上的Squid代理服务器?
我试过了,是正确的命令吗?squid restart
我正在尝试在nginx后面运行一个squid服务器.我像这样配置了nginx:
server {
listen 8080;
location / {
proxy_pass http://localhost:3128;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
Run Code Online (Sandbox Code Playgroud)
然后我将我的http网络代理设置为:
my-nginx-server-address:8080
Run Code Online (Sandbox Code Playgroud)
因此,当我尝试查看Google主页时,nginx会收到请求:
Get http://www.google.com/ HTTP/1.1
Run Code Online (Sandbox Code Playgroud)
但是当nginx将请求传递给squid时,它会将request_uri更改为
/
Run Code Online (Sandbox Code Playgroud)
所以鱿鱼不行.有什么办法可以将request_uri设置回http://www.google.com然后将其传递给squid吗?或者我可以在nginx后面运行鱿鱼的任何其他方式?
我使用 Squid 作为本地网络中 Web 缓存的代理服务器。我在 VB.NET 中开发了一个实用程序,它需要通过互联网远程连接到远程服务器上的 MySQL 数据库。如果禁用代理服务器,我可以连接到远程服务器,但如果启用代理,则无法连接到远程服务器。
我不知道在这种情况下我是否可以在本地代理服务器上使用 MySql Proxy 以及我必须进行哪些配置。
以下是我的鱿鱼配置;
ACL 定义允许通过 Squid 的端口
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 1025-65535 # 未注册端口
acl Safe_ports port 3306 # mysql 远程连接
acl CONNECT method CONNECT
http_access deny !Safe_ports
http_access允许 Safe_ports
http_access 允许 CONNECT !SSL_ports
我可以有什么替代方案来实现类似的设置,即 Web 缓存 + 远程连接到 mysql 数据库。
我正在尝试安装squid 3.5.4(在docker上,运行debian 8)并以ssl-bump模式运行它。汇编:
./configure --prefix=/opt/squid --srcdir=. --disable-maintainer-mode \
--disable-dependency-tracking --disable-silent-rules --enable-inline\
--disable-arch-native --enable-async-io=8 \
--enable-storeio=ufs,aufs,diskd,rock \
--enable-removal-policies=lru,heap --enable-delay-pools \
--enable-cache-digests --enable-icap-client \
--enable-follow-x-forwarded-for \
--enable-auth-basic=DB,fake,getpwnam,LDAP,MSNT-multi-domain,NCSA,NIS,PAM,POP3,RADIUS,SASL,SMB \
--enable-auth-digest=file,LDAP \
--enable-auth-negotiate=kerberos,wrapper \
--enable-auth-ntlm=fake,smb_lm \
--enable-external-acl-helpers=file_userip,kerberos_ldap_group,LDAP_group,session,SQL_session,unix_group,wbinfo_group \
--enable-url-rewrite-helpers=fake --enable-eui \
--enable-esi --enable-icmp --enable-zph-qos \
--disable-translation --with-filedescriptors=65536 \
--with-large-files --with-default-user=squid \
--enable-linux-netfilter \
CFLAGS="-g -O2 -fPIE -Wall" LDFLAGS="-fPIE -pie -Wl,-z,relro -Wl,-z,now" CPPFLAGS="-D_FORTIFY_SOURCE=2" \
CXXFLAGS="-g -O2 -fPIE " --enable-ssl --with-openssl --enable-ssl-crtd
Run Code Online (Sandbox Code Playgroud)
更改配置(squid.conf)(其余为默认值):
# Squid normally listens to port 3128 \
http_port 9090
sslcrtd_program /opt/squid/libexec/ssl_crtd -s …Run Code Online (Sandbox Code Playgroud) 我公司有代理
proxy=myProxy
port=myProxyPort
username=me
password=myPassword
Run Code Online (Sandbox Code Playgroud)
我尝试使用简单的 java.net 函数访问外部世界,它成功了!
System.setProperty("http.proxyHost", myProxy);
System.setProperty("http.proxyPort", myProxyPort);
Authenticator.setDefault(new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new
PasswordAuthentication(me,myPasssword.toCharArray());
}});
URL u = new URL("http://www.google.com");
HttpURLConnection con = (HttpURLConnection) u.openConnection();
DataInputStream di = new DataInputStream(con.getInputStream());
byte[] b = new byte[1024*512];
while(-1 != di.read(b,0,1024*512)) {
System.out.print(new String(b));
Run Code Online (Sandbox Code Playgroud)
不是我尝试使用 Jax-RS Resteasy 实现来做到这一点,如下所示:
Client client = new ResteasyClientBuilder().defaultProxy(myProxy, myProxyPort).build();
System.out.println(client.target("https://www.google.com").request().get().readEntity(String.class));
Run Code Online (Sandbox Code Playgroud)
我收到以下错误
Cache Access Denied
ERR_CACHE_ACCESS_DENIED
(squid/3.1.6)
Sorry, you are not currently allowed to request https://www.google.com/* from this cache until you …Run Code Online (Sandbox Code Playgroud) 为了加快MediaWiki网站的速度,该网站的内容使用了大量的模板,但是当模板完成了他们的工作时,他们几乎有静态内容我想设置一个squid服务器看看
https://www.mediawiki.org/wiki/Manual:PurgeList.php
和
https://www.mediawiki.org/wiki/Manual:Squid_caching
然后通过使用脚本执行wget/curl调用来"自动"填充squid服务器的缓存,该调用将触及Mediawiki的所有页面.我的期望是,在这个程序之后,每个页面都在squid缓存中(如果我足够大),然后每个访问都将由squid完成.
我怎么会这样工作? 例如:
到目前为止我尝试了什么
我开始时找出如何使用以下方法安装鱿鱼:
和
我通过ifconfig eth0找到了我的ip地址xx.xxx.xxx.xxx(这里没有透露)
在/etc/squid3/squid.conf我放了
http port xx.xxx.xxx.xxx:80 transparent vhost defaultsite=XXXXXX
cache_peer 127.0.0.1 parent 80 3130 originserver
acl manager proto cache_object
acl localhost src 127.0.0.1/32
# Allow access to the web ports
acl web_ports port 80
http_access allow web_ports
# Allow cachemgr access from localhost only for maintenance purposes
http_access allow manager localhost
http_access deny manager
# Allow cache purge requests from MediaWiki/localhost only
acl purge method …Run Code Online (Sandbox Code Playgroud) 我正在研发将 Squid 配置为 HTTP 和 HTTPS 透明代理。
\n\n经过一番研究,我配置了鱿鱼 HTTP 和 HTTPS 透明代理,并尝试启动鱿鱼,但我运气不好 \xef\x81\x8c 当鱿鱼启动时,我收到致命错误。
\n\n这是关于我的问题的更多描述,
\n\n问题描述:我已在 Debian 机器上安装并配置了squid3.3.4。为了启用squid作为HTTPS透明代理,我使用了公共签名证书(来自Godaddy)并在squid.conf文件中配置了相同的证书。配置完成后,我尝试启动鱿鱼,但在启动鱿鱼时出现以下错误。
\n\n\n\n\n错误: 致命: 没有为\n https_port 0.0.0.0:3129 配置有效的签名 SSL 证书\n Squid 缓存(版本 3.3.4): 异常终止。\n CPU 使用率: 0.020 秒 = 0.000 个用户 + 0.020 个系统\n 最大驻留时间大小:22416 KB\n 物理 I/O 页面错误:3\n 失败!
\n
注意:证书和私钥(在squid.conf中配置)已从tomcat密钥库(Godaddy证书)文件转换。\nSquid版本:3.3.4
\n\n请有人帮我解决这个问题。
\n\n以下是 HTTPS 透明代理配置squid.conf:
http_port 3127\n\nhttp_port 3128 intercept\n\nhttps_port 3129 intercept ssl-bump generate-host-certificates=on dynamic_cert_mem_cache_size=4MB cert=/etc/squid3/cert/squidtrans.pem \n\nkey=/etc/squid3/cert/squidtrans.key\n\nssl_bump server-first all\n\nsslcrtd_program /usr/lib/squid3/ssl_crtd -s /var/lib/ssl_db …Run Code Online (Sandbox Code Playgroud) 我们有一个带有 SSL 的 Squid 代理,使用自签名证书和 ca-bundle.cert。直到最近,NPM 安装在尝试安装时才开始失败
npm --registry https://registry.npmjs.org \ --proxy http://localhost:10080 --https-proxy http://localhost:10443 \ --ddd install express
产生错误 -
npm ERR! errno UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR! request to https://registry.npmjs.org/express failed,
reason: unable to verify the first certificate
Run Code Online (Sandbox Code Playgroud)
Squid 正在 Docker 中运行,其日志显示
NONE/200 0 CONNECT registry.npmjs.org:443 - HIER_DIRECT
Run Code Online (Sandbox Code Playgroud)
任何想法或指示将不胜感激。
我将“dns_v4_first on”添加到了squid.conf中,现在NPM错误消息是
npm verb node v8.9.3
npm verb npm v5.5.1
npm ERR! code SELF_SIGNED_CERT_IN_CHAIN
npm ERR! errno SELF_SIGNED_CERT_IN_CHAIN
npm ERR! request to https://registry.npmjs.org/express failed, reason: self signed certificate in certificate …Run Code Online (Sandbox Code Playgroud)