5 https curl search-engine wget
我最近从 HTTP 网站迁移到 HTTPS。为了使用mnogosearch搜索引擎索引该网站的所有页面,我需要执行 mnogosearch 中包含的名为“indexer”的脚本,该脚本实际上获取网站的所有页面并将它们索引到 MySQL 表中。
该“索引器”脚本必须从托管 HTTP 服务器的计算机(即虚拟专用服务器 (VPS))调用。
\n\n该脚本与我的网站的 HTTP 版本配合得很好,但我在 HTTPS 索引方面遇到问题。
\n\n事实上,为了能够索引 HTTPS 页面,我使用"virtual scheme as an external retrieval system"此链接:[ http://www.mnogosearch.org/doc/msearch-extended-indexing.html][1]
它允许使用外部程序获取HTTPS页面的内容。
\n\n它将外部程序放入名为的脚本中"curl.sh":
#!/bin/sh\nwget -r --no-check-certificate $1\nRun Code Online (Sandbox Code Playgroud)\n\n问题是这个“ wget -r --no-check-certificate https://example.com/”命令在我的本地计算机上工作(它下载我的网站“example.com”的所有页面),但当我直接从托管我的 HTTPS 服务器的 VPS 启动它时它不起作用(即示例) .com)。
在第二种情况下,它只下载index.html。
\n\n这是我在主机上执行递归 wget 时得到的结果:
\n\n$ wget -r --no-check-certificate https://example.com/\n--2015-09-06 22:22:12-- https://example.com/\nR\xc3\xa9solution de example.com (example.com)... \nConnexion vers example.com (example.com)...connect\xc3\xa9.\nLe propri\xc3\xa9taire du certificat ne concorde pas avec le nom de l\'h\xc3\xb4te \xc2\xabexample.com\xc2\xbb\nrequ\xc3\xaate HTTP transmise, en attente de la r\xc3\xa9ponse...200 OK\nLongueur: 177 [text/html]a\nSauvegarde en : \xc2\xabexample.com/index.html\xc2\xbb\n\n100%[========================================================================================================================================>] 177 --.-K/s ds 0s \n\n2015-09-06 22:22:12 (5,08 MB/s) - \xc2\xabexample.com/index.html\xc2\xbb sauvegard\xc3\xa9 [177/177]\n\nFINISHED --2015-09-06 22:22:12--\nTotal wall clock time: 0,5s\nDownloaded: 1 files, 177 in 0s (5,08 MB/s)\nRun Code Online (Sandbox Code Playgroud)\n\n并且index.html无效,这是其内容:
\n\n<html><body><h1>It works!</h1>\n<p>This is the default web page for this server.</p>\n<p>The web server software is running but no content has been added, yet.</p>\n</body></html>\nRun Code Online (Sandbox Code Playgroud)\n\n我让您注意到我的 HTTPS 服务器可以通过 8443 端口访问(我做了一个重写规则,将 HTTPS 443 请求重定向到 8443 端口)。
\n\n所以我也尝试过:
\n\nwget -r --no-check-certificate https://example.com:8443/\nRun Code Online (Sandbox Code Playgroud)\n\n在这种情况下,wget 显然尝试获取所有页面,但每个页面都有 404 错误:
\n\n$ wget -r --no-check-certificate https://example.com:8443/\n--2015-09-06 22:39:03-- https://example.com:8443/\nR\xc3\xa9solution de example.com (example.com)... \nConnexion vers example.com (example.com)||:8443...connect\xc3\xa9.\nrequ\xc3\xaate HTTP transmise, en attente de la r\xc3\xa9ponse...303 See Other\nEmplacement: index.html [suivant]\n--2015-09-06 22:39:04-- https://example.com:8443/index.html\nR\xc3\xa9utilisation de la connexion existante vers example.com:8443.\nrequ\xc3\xaate HTTP transmise, en attente de la r\xc3\xa9ponse...200 OK\nLongueur: 7389 (7,2K) [text/html]\nSauvegarde en : \xc2\xabexample.com:8443/index.html\xc2\xbb\n\n100%[========================================================================================================================================>] 7 389 --.-K/s ds 0s \n\n2015-09-06 22:39:04 (145 MB/s) - \xc2\xabexample.com:8443/index.html\xc2\xbb sauvegard\xc3\xa9 [7389/7389]\n\nChargement de robots.txt; svp ignorer les erreurs.\n--2015-09-06 22:39:04-- https://example.com:8443/robots.txt\nR\xc3\xa9utilisation de la connexion existante vers example.com:8443.\nrequ\xc3\xaate HTTP transmise, en attente de la r\xc3\xa9ponse...200 OK\nLongueur: 138 [text/plain]\nSauvegarde en : \xc2\xabexample.com:8443/robots.txt\xc2\xbb\n\n100%[========================================================================================================================================>] 138 --.-K/s\nRun Code Online (Sandbox Code Playgroud)\n\n更新:我忘了说我在 Apache 后面有一个 Twisted python 服务器,并且这个 Twisted 服务器正在侦听端口 8443,这就是为什么我做了从 443 到 8443 端口的重定向
\n小智 1
如果您有权访问服务器,最简单的解决方案可能是更改 Apache 配置,使端口 443 与端口 8443 转到同一主机/虚拟主机。然后,如果您尝试在再次连接服务器,所有使用https://example.com/的绝对链接也将正常工作,并且您将能够通过正常端口下载所有内容。
进一步,我认为您可能想要删除该-r标志并将其添加-S -O -到您的 wget 命令行中。看起来您正在使用的软件期望服务器响应的标头和正文输出在控制台上,而不是保存到文件中。
| 归档时间: |
|
| 查看次数: |
8321 次 |
| 最近记录: |