我正在尝试创建一个cron作业来访问特定的URL来执行一些维护工作。虽然从Chrome远程访问URL工作正常(返回200 OK),但使用wget在服务器上本地访问它会让我“错误503:服务不可用。”
root@domain:/home/admin/web/domain.com/public_html/# wget http://www.domain.com/index.php?route=module/marketplace&action=run_queue
[1] 30283
root@domain:/home/admin/web/domain.com/public_html/# --2016-09-06 16:02:42-- http://www.domain.com/index.php?route=module/marketplace
Resolving www.domain.com (www.domain.com)... 46.10.20.30
Connecting to www.domain.com (www.domain.com)|46.10.20.30|:80... connected.
HTTP request sent, awaiting response... 503 Service Unavailable
2016-09-06 16:02:42 ERROR 503: Service Unavailable.
我使用Apache / 2.4.7(Ubuntu)+ Nginx来提供静态文件。
Chrome发送的标题
GET /index.php?route=module/marketplace&action=run_queue HTTP/1.1
Host: www.domain.com
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
DNT: 1
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8,ro;q=0.6
Cookie: cookieconsent_dismissed=yes; __tawkuuid=e::domain.com::qsV03tUWg5avl3mTmLetAJpcbS+TGvpb7L33ER0ooHvJ0wsAPilIfGadi5f::2; Tawk_55ec3df37d21121ad0a5a=vs16.tawk.to:443::0; currency=USD; __atuvc=10%7C34; PHPSESSID=foru997tgbo437je6djtd3c2; language=ro; _ga=GA1.2.13206174.14484999; TawkConnectionTime=0; language=ro; currency=RON
Chrome中收到的标题
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 06 Sep 2016 13:22:23 GMT
Content-Type: text/html
Content-Length: 0
Connection: keep-alive
Keep-Alive: timeout=10
X-Powered-By: PHP/5.5.9-1ubuntu4.19
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
这可能是什么问题?
答案 0 :(得分:0)
玛格丽特布鲁姆在我的问题下面的评论解决了我的问题。这实际上是一个身份验证问题,一旦我将网站正确配置为可公开访问,wget就会开始正常工作。
它最初在Chrome中工作,因为我在那里进行了身份验证。
感谢。