curl – 来自专用服务器的HTTPS网站的wget
我最近从HTTP网站迁移到HTTPS.为了使用mnogosearch搜索引擎索引本网站的所有页面,我需要执行一个名为“indexer”的mnogosearch中包含的脚本,它实际上获取webite的所有页面并将它们索引到
MySQL表中.
必须从托管HTTP服务器的计算机(即虚拟专用服务器(VPS))调用此“索引器”脚本. 这个脚本非常适合我的网站的HTTP版本,但我有HTTPS索引的问题. 实际上,为了能够索引HTTPS页面,我从这个链接使用“虚拟方案作为外部检索系统”:[http://www.mnogosearch.org/doc/msearch-extended-indexing.html][1] 它允许使用外部程序来获取HTTPS页面的内容. 它将外部程序放入名为“curl.sh”的脚本中: #!/bin/sh wget -r --no-check-certificate $1 问题是这个“wget -r –no-check-certificate https://example.com/”命令可以在我的本地机器上运行(它下载我的网站“example.com”的所有页面)但它不起作用当我直接从托管我的HTTPS服务器的VPS(即example.com)启动它时. 在第二种情况下,它只下载index.html. 这是我在托管机器上执行递归wget时得到的结果: $wget -r --no-check-certificate https://example.com/ --2015-09-06 22:22:12-- https://example.com/ Résolution de example.com (example.com)... Connexion vers example.com (example.com)...connecté. Le propriétaire du certificat ne concorde pas avec le nom de l'h?te ?example.com? requête HTTP transmise,en attente de la réponse...200 OK Longueur: 177 [text/html]a Sauvegarde en : ?example.com/index.html? 100%[========================================================================================================================================>] 177 --.-K/s ds 0s 2015-09-06 22:22:12 (5,08 MB/s) - ?example.com/index.html? sauvegardé [177/177] FINISHED --2015-09-06 22:22:12-- Total wall clock time: 0,5s Downloaded: 1 files,177 in 0s (5,08 MB/s) 并且index.html无效,这里是它的内容: <html><body><h1>It works!</h1> <p>This is the default web page for this server.</p> <p>The web server software is running but no content has been added,yet.</p> </body></html> 我告诉你我的HTTPS服务器可以通过8443端口访问(我做了一个重写规则,将HTTPS 443请求重定向到8443端口). 所以我也尝试过: wget -r --no-check-certificate https://example.com:8443/ 在这种情况下,wget尝试显然是为了获取所有页面,但每页都有404错误: $wget -r --no-check-certificate https://example.com:8443/ --2015-09-06 22:39:03-- https://example.com:8443/ Résolution de example.com (example.com)... Connexion vers example.com (example.com)||:8443...connecté. requête HTTP transmise,en attente de la réponse...303 See Other Emplacement: index.html [suivant] --2015-09-06 22:39:04-- https://example.com:8443/index.html Réutilisation de la connexion existante vers example.com:8443. requête HTTP transmise,en attente de la réponse...200 OK Longueur: 7389 (7,2K) [text/html] Sauvegarde en : ?example.com:8443/index.html? 100%[========================================================================================================================================>] 7 389 --.-K/s ds 0s 2015-09-06 22:39:04 (145 MB/s) - ?example.com:8443/index.html? sauvegardé [7389/7389] Chargement de robots.txt; svp ignorer les erreurs. --2015-09-06 22:39:04-- https://example.com:8443/robots.txt Réutilisation de la connexion existante vers example.com:8443. requête HTTP transmise,en attente de la réponse...200 OK Longueur: 138 [text/plain] Sauvegarde en : ?example.com:8443/robots.txt? 100%[========================================================================================================================================>] 138 --.-K/s 更新:我忘了说我在Apache后面有一个Twisted python服务器,这个Twisted服务器正在端口8443上监听,这就是为什么我从443端口重定向到8443端口 解决方法
如果您可以访问服务器,最简单的解决方案可能是更改Apache配置,以便端口443转到与端口8443相同的主机/虚拟主机.然后,如果您尝试再次在服务器上下载
https://example.com/,则所有绝对使用
https://example.com/的链接也可以正常工作,您可以通过普通端口下载所有内容.
接下来,我想您可能想要删除-r标志并将-S -O添加到您的wget命令行,.看起来您正在使用的软件期望服务器响应的标题和正文在控制台上输出,而不是保存到文件中. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |