2015-03-31 78 views
0

我使用cron任務向同一服務器發送了對網址的請求。在過去,我這樣做是下一個bash腳本:使用https對相同的服務器進行卷曲bash

#!/bin/sh 

curl "http://www.mydomain.es/myfolder/importTwitter" >> /var/log/mydomain/import_twitter.log 

我的網站遷移到HTTPS和curl命令失敗,返回一個錯誤:

* About to connect() to www.mydomain.es port 443 (#0) 
* Trying xxx.xxx.xxx.xxx... 
* Connection refused 
* couldn't connect to host 
* Closing connection #0 
curl: (7) couldn't connect to host 

我曾嘗試添加下一個參數到curl命令,並得到了同樣的錯誤:

--cacert -> specify ssl ca root certificate 
--cert -> specify ssl pem certificate 
--location -> using the http url and force to follow redirects 
--insecure -> allows insecure curl connections 

最後我也試圖讓從另一臺主機的請求,並能正常工作,但我必須這樣做從同一個服務器的請求。

服務器有Debian的3.2.65-1 + deb7u2 x86_64的

捲曲版本:

curl 7.26.0 (x86_64-pc-linux-gnu) libcurl/7.26.0 OpenSSL/1.0.1e zlib/1.2.7 libidn/1.25 libssh2/1.4.2 librtmp/2.3 
Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s rtmp rtsp scp sftp smtp smtps telnet tftp 
Features: Debug GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP 

回答

1

* Connection refused

你有你的問題就在這裏。早在密碼的任何事情可以開始之前,你的服務器根本不允許來自主機的連接。

確保您的服務器配置正確,並且沒有防火牆阻止端口443的環回連接。

+0

工作正常!謝謝! – 2015-04-01 09:32:18