问题描述
我没有.htaccess文件。我有index.php,它具有以下内容,并且可以在Chrome或Safari这样的浏览器中很好地工作:
I have no .htaccess file. I have index.php which has the following content and works beautifully in a browser like Chrome, or Safari:
<?php print "hello world"; ?>
在浏览器中加载它时,您会得到:世界。
当我尝试以下任一操作时,我将收到错误500:内部服务器错误。
When I load it in a browser I get: hello world. When I try any of the following I get ERROR 500: Internal Server Error.
- / usr / bin / wget
- / usr / bin / wget -nv -t 5 --connect-timeout = 4 -w 4 --connect-timeout = 20 -nd --no-cache --no-cookies
- / usr / bin / wget --content-on-错误
- / usr / bin / wget --header =接受:文本/ html --user-agent = Mozilla / 5.0(Macintosh; Intel Mac OS X 10.8; rv:21.0)Gecko / 20100101 Firefox / 21.0
- curl
- /usr/bin/wget http://example.com/index.php
- /usr/bin/wget -nv -t 5 --connect-timeout=4 -w 4 --connect-timeout=20 -nd --no-cache --no-cookies http://example.com/index.pp
- /usr/bin/wget --content-on-error http://example.com/index.php
- /usr/bin/wget --header="Accept: text/html" --user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0"
- curl http://example.com/index.php
我检查了所有apache日志文件,除了将其加载到webrowser中之外,什么都看不到。
I checked all apache log files and can see nothing there at all except for when I load it in a webrowser.
此是Ubuntu 16.04 php7.0 Apache2。所有新安装和更新的版本以及截至2016年11月3日的最新版本
This is Ubuntu 16.04 php7.0 Apache2. All freshly installed and updated and the laest version as of Nov 3rd 2016
我尝试重新安装wget。我尝试了其他机器和本地机器上的wget。
I tried reinstalling wget. I tried wget from other machines and the local machine.
我尝试将清漆放在端口80上,将8080端口的apache放在清漆后面...这并没有改变任何内容
I have tried putting varnish on port 80 and apache on port 8080 behind varnish... that didn't change anything.
Wget通过调试胜过以下操作:
Wget outpus the following with debug:
root@one:~# wget --debug http://example.com/index.php
DEBUG output created by Wget 1.17.1 on linux-gnu.
Reading HSTS entries from /root/.wget-hsts
URI encoding = ‘UTF-8’
--2016-11-03 07:51:27-- http://example.com/index.php
Resolving example.com (example.com)... 207.158.37.70
Caching example.com =207.158.37.70
Connecting to example.com (example.com)|207.158.37.70|:80... connected.
Created socket 3.
Releasing 0x0000561eeda0d190 (new refcount 1).
---request begin---
GET /index.php HTTP/1.1
User-Agent: Wget/1.17.1 (linux-gnu)
Accept: */*
Accept-Encoding: identity
Host: example.com
Connection: Keep-Alive
---request end---
HTTP request sent, awaiting response...
---response begin---
HTTP/1.1 500 Internal Server Error
Server: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.20 OpenSSL/1.0.1f mod_perl/2.0.8 Perl/v5.18.2
Content-Type: text/html; charset=iso-8859-1
Content-Length: 538
Accept-Ranges: bytes
Date: Thu, 03 Nov 2016 14:49:42 GMT
X-Varnish: 2177415129
Age: 0
Via: 1.1 varnish
Connection: keep-alive
---response end---
500 Internal Server Error
Registered socket 3 for persistent reuse.
URI content encoding = ‘iso-8859-1’
Skipping 538 bytes of body: [<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator at
[email protected] to inform them of the time this error occurred,
and the actions you performed just before this error.</p>
<p>More information about this error may be available
in the server erroSkipping 26 bytes of body: [r log.</p>
</body></html>
] done.
2016-11-03 07:51:27 ERROR 500: Internal Server Error.
Saving HSTS entries to /root/.wget-hsts
root@one:~#
推荐答案
我注意到服务器上的另一个域名正常工作。因此,我复制了虚拟主机,重新加载了Apache,但仍然无法正常工作。我把所有事情都弄清楚了。最终,我看到DNS被指向我的开发服务器,该服务器未侦听我的域名并返回错误500。
I noticed another domain name on the server worked. So, I copied the vhost, reloaded apache and it still was not working. I made everything exact. In the end I saw DNS was pointed to my dev server which was not listening for my domain name and returning an error 500.
更新了DNS之后,节目又重新开始了。感谢您为我完成具有创意的工作!
Updated DNS and the show is back on. Thanks for working me through things with ideas!
这篇关于新安装时,curl和wget为helloworld.php返回错误500,但浏览器正常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!