AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-1973

Justin's questions

Martin Hope
Justin
Asked: 2012-10-12 15:03:38 +0800 CST

为什么清漆不缓存?

  • 3

我正在对我的 Ubuntu 服务器上的 Varnish 3.x 设置进行故障排除。我通过基于命名的虚拟主机在盒子上设置的两个站点上运行 Drupal 7。在尝试让 Varnish 与 Drupal 配合使用之前,我正在尝试从缓存中将 Varnish 转换为 PNG。

以下是我从curl -IPNG 文件请求中获得的标头:

HTTP/1.1 200 OK
Server: Apache/2.2.22 (Ubuntu)
Last-Modified: Sun, 07 Oct 2012 21:18:59 GMT
ETag: "a57c2-3850-4cb7ea73db6c0"
Accept-Ranges: bytes
Content-Length: 14416
Cache-Control: max-age=1209600
Expires: Thu, 25 Oct 2012 22:55:14 GMT
Content-Type: image/png
Accept-Ranges: bytes
Date: Thu, 11 Oct 2012 22:55:14 GMT
X-Varnish: 1766703058
Age: 0
Via: 1.1 varnish
Connection: keep-alive
X-Varnish-Cache: MISS

以下是同一文件的标头,但绕过了 Varnish(端口 8080):

HTTP/1.1 200 OK
Date: Sat, 13 Oct 2012 13:16:17 GMT
Server: Apache/2.2.22 (Ubuntu)
Last-Modified: Sun, 07 Oct 2012 21:18:59 GMT
ETag: "a57c2-3850-4cb7ea73db6c0"
Accept-Ranges: bytes
Content-Length: 14416
Cache-Control: max-age=1209600
Expires: Sat, 27 Oct 2012 13:16:17 GMT
Content-Type: image/png

这是我正在使用的 Varnish VCL 文件(这是为 Drupal 设计的默认 VCL 配置):

# Default backend definition.  Set this to point to your content
# server.
#
backend default {
  .host = "127.0.0.1";
  .port = "8080";
}

# Respond to incoming requests.
sub vcl_recv {
  # Use anonymous, cached pages if all backends are down.
  if (!req.backend.healthy) {
    unset req.http.Cookie;
  }

  # Allow the backend to serve up stale content if it is responding slowly.
  set req.grace = 6h;

  # Pipe these paths directly to Apache for streaming.
  #if (req.url ~ "^/admin/content/backup_migrate/export") {
  #  return (pipe);
  #}

  # Do not cache these paths.
  if (req.url ~ "^/status\.php$" ||
      req.url ~ "^/update\.php$" ||
      req.url ~ "^/admin$" ||
      req.url ~ "^/admin/.*$" ||
      req.url ~ "^/flag/.*$" ||
      req.url ~ "^.*/ajax/.*$" ||
      req.url ~ "^.*/ahah/.*$") {
       return (pass);
  }

  # Do not allow outside access to cron.php or install.php.
  #if (req.url ~ "^/(cron|install)\.php$" && !client.ip ~ internal) {
    # Have Varnish throw the error directly.
  #  error 404 "Page not found.";
    # Use a custom error page that you've defined in Drupal at the path "404".
    # set req.url = "/404";
  #}

  # Always cache the following file types for all users. This list of extensions
  # appears twice, once here and again in vcl_fetch so make sure you edit both
  # and keep them equal.
  if (req.url ~ "(?i)\.(pdf|asc|dat|txt|doc|xls|ppt|tgz|csv|png|gif|jpeg|jpg|ico|swf|css|js)(\?.*)?$") {
    unset req.http.Cookie;
  }

  # Remove all cookies that Drupal doesn't need to know about. We explicitly 
  # list the ones that Drupal does need, the SESS and NO_CACHE. If, after 
  # running this code we find that either of these two cookies remains, we 
  # will pass as the page cannot be cached.
  if (req.http.Cookie) {
    # 1. Append a semi-colon to the front of the cookie string.
    # 2. Remove all spaces that appear after semi-colons.
    # 3. Match the cookies we want to keep, adding the space we removed 
    #    previously back. (\1) is first matching group in the regsuball.
    # 4. Remove all other cookies, identifying them by the fact that they have
    #    no space after the preceding semi-colon.
    # 5. Remove all spaces and semi-colons from the beginning and end of the 
    #    cookie string. 
    set req.http.Cookie = ";" + req.http.Cookie;
    set req.http.Cookie = regsuball(req.http.Cookie, "; +", ";");    
    set req.http.Cookie = regsuball(req.http.Cookie, ";(SESS[a-z0-9]+|SSESS[a-z0-9]+|NO_CACHE)=", "; \1=");
    set req.http.Cookie = regsuball(req.http.Cookie, ";[^ ][^;]*", "");
    set req.http.Cookie = regsuball(req.http.Cookie, "^[; ]+|[; ]+$", "");

    if (req.http.Cookie == "") {
      # If there are no remaining cookies, remove the cookie header. If there
      # aren't any cookie headers, Varnish's default behavior will be to cache
      # the page.
      unset req.http.Cookie;
    }
    else {
      # If there is any cookies left (a session or NO_CACHE cookie), do not
      # cache the page. Pass it on to Apache directly.
      return (pass);
    }
  }
}

# Set a header to track a cache HIT/MISS.
sub vcl_deliver {
  if (obj.hits > 0) {
    set resp.http.X-Varnish-Cache = "HIT";
  }
  else {
    set resp.http.X-Varnish-Cache = "MISS";
  }
}

# Code determining what to do when serving items from the Apache servers.
# beresp == Back-end response from the web server.
sub vcl_fetch {
  # We need this to cache 404s, 301s, 500s. Otherwise, depending on backend but 
  # definitely in Drupal's case these responses are not cacheable by default.
  if (beresp.status == 404 || beresp.status == 301 || beresp.status == 500) {
    set beresp.ttl = 10m;
  }

  # Don't allow static files to set cookies. 
  # (?i) denotes case insensitive in PCRE (perl compatible regular expressions).
  # This list of extensions appears twice, once here and again in vcl_recv so 
  # make sure you edit both and keep them equal.
  if (req.url ~ "(?i)\.(pdf|asc|dat|txt|doc|xls|ppt|tgz|csv|png|gif|jpeg|jpg|ico|swf|css|js)(\?.*)?$") {
    unset beresp.http.set-cookie;
  }

  # Allow items to be stale if needed.
  set beresp.grace = 6h;
}

# In the event of an error, show friendlier messages.
sub vcl_error {
  # Redirect to some other URL in the case of a homepage failure.
  #if (req.url ~ "^/?$") {
  #  set obj.status = 302;
  #  set obj.http.Location = "http://backup.example.com/";
  #}

  # Otherwise redirect to the homepage, which will likely be in the cache.
  set obj.http.Content-Type = "text/html; charset=utf-8";
  synthetic {"
<html>
<head>
  <title>Page Unavailable</title>
  <style>
    body { background: #303030; text-align: center; color: white; }
    #page { border: 1px solid #CCC; width: 500px; margin: 100px auto 0; padding: 30px; background: #323232; }
    a, a:link, a:visited { color: #CCC; }
    .error { color: #222; }
  </style>
</head>
<body onload="setTimeout(function() { window.location = '/' }, 5000)">
  <div id="page">
    <h1 class="title">Page Unavailable</h1>
    <p>The page you requested is temporarily unavailable.</p>
    <p>We're redirecting you to the <a href="/">homepage</a> in 5 seconds.</p>
    <div class="error">(Error "} + obj.status + " " + obj.response + {")</div>
  </div>
</body>
</html>
"};
  return (deliver);
}

我每次都得到 MISS 和 0 岁。如果我理解正确,这意味着文件不是从 Varnish 的缓存中返回的。我的清漆配置有问题吗?

更新:

正如建议的那样,我从一个基本的 VCL 文件开始,但每次我仍然会错过。VCL 配置是:

# Default backend definition.  Set this to point to your content
# server.
#
backend default {
  .host = "127.0.0.1";
  .port = "8080";
}

# Respond to incoming requests.
sub vcl_recv {
  unset req.http.Cookie;
}

# Set a header to track a cache HIT/MISS.
sub vcl_deliver {
  if (obj.hits > 0) {
    set resp.http.X-Varnish-Cache = "HIT";
  }
  else {
    set resp.http.X-Varnish-Cache = "MISS";
  }
}

# Code determining what to do when serving items from the Apache servers.
# beresp == Back-end response from the web server.
sub vcl_fetch {
  unset beresp.http.set-cookie;
}

我正在继续排除故障。

apache-2.2
  • 2 个回答
  • 16905 Views
Martin Hope
Justin
Asked: 2010-02-02 13:54:56 +0800 CST

在没有 SIP 服务器的情况下设置已擦除的 Polycom 电话

  • 0

我正在对 Polycom SoundPoint IP 550 进行故障排除。我已经擦除了手机的硬盘(通过菜单选项),现在它卡在重启周期中。显然,设置手机固件的唯一方法是使用引导服务器。

有谁知道另一种设置电话/固件的方法?

voip polycom
  • 2 个回答
  • 849 Views
Martin Hope
Justin
Asked: 2010-01-27 16:40:47 +0800 CST

如何在 Microsoft DNS 中设置区域优先级?

  • 4

我在 Active Directory 上有一个标准的小型网络设置(20 个用户)。所有 Windows 机器都有一个作为 AD 的主 DNS 服务器和一个作为 Google PDNS 的辅助 DNS 服务器。我想设置一个存在于真实 DNS 中的 DNS 条目,但在我们的 DC 上设置它,以便本地请求将此公共域路由到网络上的本地开发机器。

我在 DNS 中设置了区域,这导致客户端将公共 FQDN 解析为我们的内部 IP。但是,有时它仍会解析为“真实”值(我通过 ping 来检查)。有没有办法让我的 DC DNS 中的区域定义具有更高的优先级?或者,具有辅助公共 DNS 的客户端有时是否会在该区域有竞争条目?

domain-name-system active-directory
  • 2 个回答
  • 1749 Views
Martin Hope
Justin
Asked: 2010-01-21 15:31:20 +0800 CST

Cisco SPA-942 的默认用户名和密码是什么?

  • 2

我似乎找不到 Linksys/Cisco SPA-942 VoIP 电话的 Web 管理界面的默认管理员用户名和密码。它是什么?

cisco linksys voip
  • 2 个回答
  • 23822 Views
Martin Hope
Justin
Asked: 2010-01-14 14:25:20 +0800 CST

Adobe Acrobat 8​​ Professional 在 Windows 2008 Server 上随机打开 PDF

  • 0

我有一个 Windows 2008 服务器作为一个小团队的终端服务器。当您双击另一个 PDF 时,服务器会“有时一致地”随机打开同一个 PDF 文件。两个 PDF 都打开。

  • 这发生在多个用户身上。
  • 这已经发生了几个月。
  • 当您打开 Acrobat 本身(从快捷方式)时,不会发生这种情况
  • 并非每次打开 PDF 时都会发生这种情况,而是经常发生。

我试过谷歌搜索无济于事。我真的不知道从哪里开始。除了“重命名或移动打开的 PDF”之外,有人有什么想法吗?

windows-server-2008 pdf adobe adobe-acrobat
  • 1 个回答
  • 461 Views
Martin Hope
Justin
Asked: 2010-01-07 12:48:49 +0800 CST

推荐的 Mac 杀毒客户端

  • 4

对于办公环境中使用的 Mac,您推荐什么防病毒客户端?(我不是在问你是否应该在 Mac 上运行 AV,我是在询问客户的建议。)

候选人:

  • 索福斯
  • ClamxAV
  • 其他的?
anti-virus mac-osx mac security
  • 2 个回答
  • 223 Views
Martin Hope
Justin
Asked: 2009-11-01 06:51:16 +0800 CST

为远程桌面登录添加额外的身份验证

  • 0

我们有一个运行终端服务器的 Windows Server 2008 Standard 机器,我们的团队成员通过路由器 (Linksys RV042) 中的防火墙规则从网络外位置连接到该终端服务器。出于安全原因,我们已将默认 TS 端口更改为未使用的高级端口号。

我们想添加一个额外的安全层,即与终端服务器无关且与用户登录凭据无关的用户名/密码质询。我不确定这是否可能。

我在这里要做的就像通过一个 htaccess 文件在 wordpress 安装的 wp-admin 目录上添加一个 Apache 密码挑战,它有自己的登录名。所以第一个身份验证机制是通过一个不运行第二个身份验证机制的服务。

任何想法我们可以如何做到这一点?

windows-server-2008
  • 5 个回答
  • 553 Views
Martin Hope
Justin
Asked: 2009-10-17 12:33:23 +0800 CST

无法浏览 Internet Explorer 8 受信任的站点

  • 1

安装 QuickBooks 2009 Pro (QB) 后,我收到需要更改 IE 8 安全设置的提示。当我单击“修复错误”时,它会打开标准的 IE 8 将站点添加到受信任站点对话框。

第一个添加很好,但 QB 尝试添加的第二个是:

intu-help-qb2://

IE 8 不会接受这个值。我需要正确的值。

我的感觉是它应该是本地帮助文件的路径,但它一直想添加这个不会添加的字符串。

信息:

  • 视窗服务器 2008
  • 快书 2009 专业版
  • 以前从未在这台机器上安装过 QB
internet-explorer-8
  • 2 个回答
  • 1065 Views
Martin Hope
Justin
Asked: 2009-09-11 09:33:44 +0800 CST

在 VPN 连接下从 Mac 连接到 Windows 文件共享时经常出现错误消息

  • 0

我有一个简单的 Windows 域设置,大约有 15 个 Windows 桌面和 5 个 Mac(都在现场,本地网络),很高兴地连接到我们文件服务器上的一些文件共享。

我在使用一台异地 Mac OSX 10.3 时遇到问题,它使用 VPN 连接到我们的 Windows 提供的 VPN 服务器以连接到办公室并映射文件共享。通常,当访问文件共享上的文件时,此用户会收到一两个错误:

“操作无法完成,因为找不到一项或多项所需项目。(错误代码 -1401)”

“Finder无法完成操作,因为“home1-final.psd”中的某些数据无法写入。(错误代码-36)

  1. 该用户一年多以来一直以这种方式访问​​文件而没有出现任何问题
  2. 自问题开始以来,客户端/用户 Mac 的文件服务器上未发生任何配置更改或安装
  3. 用户大部分时间都可以使用这些文件,但经常会遇到这些错误。

这是在Windows Server 2003和Mac OS X 10.50.8 下。

有任何想法吗?

windows-server-2003
  • 2 个回答
  • 2490 Views
Martin Hope
Justin
Asked: 2009-09-03 07:36:37 +0800 CST

可以在 Google Analytics 中获取退出 URL 吗?

  • 3

我有一个使用 Google Analytics (GA) 设置的网站。我正在寻找离开网站时访问者最常访问的 URL。

我知道如何在站点本身中获取退出 URL,这是它们最后所在的位置,但是它们将在 GA 中跟踪的外部 URL 吗?浏览器是否甚至会告诉正在移动的页面离开下一个 URL 的位置?如果没有,我假设谷歌确定退出页面是因为没有看到该特定用户的更多点击。

谢谢,j

google-analytics
  • 1 个回答
  • 3754 Views
Martin Hope
Justin
Asked: 2009-08-04 11:10:50 +0800 CST

Google Mini 经常超时

  • 1

我有一台 Google Mini 设备,已成功配置为我们网络上的两个网站建立索引。

问题是,大约 50% 的时间我加载管理站点 http://192.168.0.150:8000(我们的内部 IP)我收到“无法连接”消息,就好像服务器已关闭一样。

此外,有时当我使用管理站点时,我会在新选项卡 (192.168.0.150) 中打开主搜索,然后当我返回管理站点时它不再起作用。

通常的解决方法是关闭所有浏览器并重试。

此问题出现在 FF3、IE8 和 Chrome 上。

我查看了网络设置并确认它们对我来说看起来不错(诊断没有错误)。我真的不知道还有什么要解决的问题。有我不知道的补丁吗?有没有其他人看到这个问题?

任何故障排除的想法?

j

google-search-appliance
  • 1 个回答
  • 215 Views
Martin Hope
Justin
Asked: 2009-06-04 06:55:29 +0800 CST

LAMP 服务器监控脚本中包含的内容

  • 1

我们有几个 LAMP 服务器,每个服务器运行一个我们编写的特殊脚本来报告各种系统指标。该报告每天运行,其想法是能够快速通过并发现系统上的任何潜在问题。

每台 LAMP 服务器运行 RedHat Enterprise 并托管 40-50 个(并且还在不断增长)面向公众的网站(HTML、自定义 PHP 和 Drupal 站点的混合)。

以下是脚本当前包含的内容:

  1. 服务器负载和用户登录
  2. 最近 10 次登录和次数
  3. 磁盘使用情况
  4. 各种日志的最后 10 行(qmail、mysql、secure、apache 错误、包)
  5. 每个帐户的用户名、端口和上次登录时间
  6. 顶部转储

报告已经很长了,所以我对尽可能简洁感兴趣。

您是否发现其他重要的指标可以包含在这样的脚本中?你会从这个列表中删除任何一个吗?

谢谢,团队。

j

linux monitoring lamp
  • 6 个回答
  • 564 Views
Martin Hope
Justin
Asked: 2009-05-27 04:56:30 +0800 CST

日历文件夹的 PST 备份的导入被拒绝,因为不包含日历数据

  • 1

我最近将 Outlook 上的用户使用 pop 帐户(PST 文件)迁移到 Exchange(OST 文件)。我们需要将他的联系人从 PST 文件导入到他的 Exchange 框中的新日历中。

我将 PST 文件夹添加回 Outlook,并将日历项目的文件导出到新的 PST 文件。然后我使用 Import 将该文件导入到他的 Exchange 邮箱中的 Calendar 文件夹中。导入例程抱怨导入文件不包含日历数据(文件为 5 mb)。

我在另一个从 POP 到 Exchange 的 Outlook 用户上使用了这种方法,没有任何问题。

有任何想法吗?

jpe

exchange outlook
  • 4 个回答
  • 864 Views
Martin Hope
Justin
Asked: 2009-05-23 14:41:13 +0800 CST

在登录出现之前远程桌面连接断开

  • 2

我有一个启用了远程桌面的客户端,但无法在我们的本地网络中连接。当我在连接框中输入机器 ip/port 并点击连接时,它会短暂显示正常的“正在连接...”对话框。

但是,2 秒后它就下降了。没有错误信息,什么都没有。就像什么都没发生一样消失。

  • 视窗 XP SP3
  • RDP 端口更改为 31444(从 32325 更改为不起作用)
  • Windows 防火墙对 31444 TCP 开放
  • 机器在域上
  • RDP 在我的电脑中启用
  • 用户是本地管理员

我在同一个域上有许多其他机器具有相同的 GPO 工作正常。

有任何想法吗?

jpe

windows-xp rdp
  • 2 个回答
  • 934 Views
Martin Hope
Justin
Asked: 2009-05-22 11:11:23 +0800 CST

SQL Server Management Studio 连接失败到 COM 错误

  • 0

我有一个在 Windows 2008 服务器上运行的 SQL Server 2008 实例。我可以从我网络上的几台机器连接到这个 SQL 服务器。但是,我无法在 SQL Server 本身上使用 SQL Management Studio 进行连接。

当我点击“连接”时,我收到此错误:

无法将“System.__ComObject”类型的 COM 对象转换为接口类型“Microsoft.VisualStudio.OLE.Interop.IServiceProvider”。此操作失败,因为 IID 为“{6D5140C1-7436-11CE-8034-00AA006009FA}”的接口的 COM 组件上的 QueryInterface 调用因以下错误而失败:不支持此类接口(HRESULT 异常:0x80004002 (E_NOINTERFACE)) . (Microsoft.VisualStudio.OLE.Interop)

服务器配置:

  • SQL 服务器 2005
  • Windows Server 2008 标准 32 位
  • 还在端口 1444 上运行 SQL Server 2000

我试过了:

  • 卸载并重新安装 SQL Management Studio
  • 添加这些注册表项
  • 重新启动
  • 运行这些命令:

对于 (%windir%\system32*.dll) 中的 %1 执行 regsvr32 /s %1

对于 (%windir%\system32*.ocx) 中的 %1 执行 regsvr32 /s %1

  • 运行 regsvr32 actxprxy.dll,产生错误

有任何想法吗?

贾斯汀

sql-server ssms sql-server-2008
  • 2 个回答
  • 2922 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve