wget 地址 连接超时,wget连接在同一服务器上超时

I've got a very strange problem.

There's a cron job on the server to run a script daily:

wget -O /dev/null --timeout=300 --tries=1 "http://website.com/script"

It was all working well since about two weeks ago, I started receiving errors:

--2016-07-13 09:45:01-- http://website.com/script

Resolving website.com (website.com)... 11.22.33.44

Connecting to website.com (website.com)|11.22.33.44|:80... failed: Connection timed out.

Giving up.

These are some information for this question:

The cron job is on the same server of http://website.com hosted.

I can access the script (http://website.com/script) correctly from browser on my desktop.

The server is CentOS 7, with WHM and cPanel installed.

Anyone know what could be the issue? or how do I suppose to identify the issue?

Thanks

解决方案

If the issue still is unresolved..

You could try running wget in debug mode to see if you get some more info.

wget -dv -O /dev/null --timeout=300 --tries=1 "http://website.com/script"

Also, confirm if the resolved IP "11.22.33.44" belongs to one of the servers NIC's.

ip a s (ip address show) or

ifconfig -a

If the IP is not listed, It could be that the ip "11.22.33.44" is a public facing address of the company's firewall. And that the FW is directing requests on port 80 from the outside/internet (where you're browser is) to that specific server. And the Firewall/Nat/Proxy, could be configured to not allow requests coming from inside the network, reaching the external IP of the firewall and getting back in.

If this is the case, you could try changing you're wget using the internal ip address, something like: (still using -dv for debugging, remove after)

wget -dv -O /dev/null --timeout=300 --tries=1 --header="Host: website.com" http://127.0.0.1/script

Note1: the --header="Host: website.com" will tell you're webserver what site you wanna reach

Note2: maybe you'll have to change the IP: 127.0.0.1 (localhost address) to one of the server's NIC addresses.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值