XAMPP + Wordpress:500 内部服务器错误

Posted

技术标签:

【中文标题】XAMPP + Wordpress:500 内部服务器错误【英文标题】:XAMPP + Wordpress: 500 Internal Server Error 【发布时间】:2018-08-19 18:35:02 【问题描述】:

我目前正在尝试使用本教程设置运行 Wordpress 网站的 XAMPP Web 服务器:https://code.tutsplus.com/articles/how-to-setup-a-wordpress-development-environment-for-windows--wp-23365

一切顺利后,在完成最后一步后,我的 wordpress 模板的核心 html 加载,但所有样式表和帖子都无法打开。通过 localhost 加载 index.php 后,我得到以下信息:

screenshot of the page

经过一番搜索,我查看了 Apache 错误日志,发现如下:

[Sun Mar 11 00:49:27.099600 2018] [ssl:warn] [pid 9888:tid 552] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Mar 11 00:49:27.145220 2018] [core:warn] [pid 9888:tid 552] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Sun Mar 11 00:49:27.150665 2018] [ssl:warn] [pid 9888:tid 552] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Mar 11 00:49:27.178739 2018] [mpm_winnt:notice] [pid 9888:tid 552] AH00455: Apache/2.4.29 (Win32) OpenSSL/1.1.0g PHP/7.2.2 configured -- resuming normal operations
[Sun Mar 11 00:49:27.178739 2018] [mpm_winnt:notice] [pid 9888:tid 552] AH00456: Apache Lounge VC15 Server built: Nov  3 2017 10:30:36
[Sun Mar 11 00:49:27.178739 2018] [core:notice] [pid 9888:tid 552] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Sun Mar 11 00:49:27.199797 2018] [mpm_winnt:notice] [pid 9888:tid 552] AH00418: Parent: Created child process 20752 AH00548: NameVirtualHost has no effect and will be removed in the next release C:/xampp/apache/conf/extra/httpd-vhosts.conf:2
[Sun Mar 11 00:49:27.783347 2018] [ssl:warn] [pid 20752:tid 620] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Mar 11 00:49:27.829470 2018] [ssl:warn] [pid 20752:tid 620] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Mar 11 00:49:27.856542 2018] [mpm_winnt:notice] [pid 20752:tid 620] AH00354: Child: Starting 150 worker threads.
[Sun Mar 11 00:49:36.078032 2018] [core:error] [pid 20752:tid 1828] [client 127.0.0.1:62660] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: http://127.0.0.1/wp-vs-494/wp-admin/
[Sun Mar 11 00:49:36.078534 2018] [core:error] [pid 20752:tid 1828] [client 127.0.0.1:62660] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: http://127.0.0.1/wp-vs-494/wp-admin/

请注意最后两行声明超出了 10 个内部重定向的限制,可能是由于配置错误。之后,同样的消息继续重复许多类型。

不幸的是,我没有任何设置本地 Web 服务器的经验,所以我不知道该怎么做。我查看了多个 *** 建议并浏览了所有文件,但我迷路了。有没有其他人经历过这种情况,或者有人知道我能做什么?提前干杯

编辑:经过一番搜索,我发现人们大多在修改他们的 .htaccess 文件,这是我的:

# BEGIN WordPress
<IfModule mod_rewrite.c>    
RewriteEngine On    
RewriteBase /wp_vs_494/ 
RewriteRule ^index\.php$ - [L]
RewriteCond %REQUEST_FILENAME !-f 
RewriteCond %REQUEST_FILENAME !-d
RewriteRule . /wp_vs_494/index.php [L]
</IfModule>
# END WordPress

另外,这是我的 C:/xampp/htdocs/ 文件夹的目录结构:

C:/xampp/htdocs/ structure

【问题讨论】:

我认为是永久链接修改问题,请从 WordPress 管理员重置永久链接。 您好 PPL,感谢您的回复。你能澄清一下吗?我登录到 WordPress 管理页面,然后准确地重置“什么”永久链接? 【参考方案1】:

经过进一步调查,我发现一个 .htaccess 文件配置解决了这个问题。第二行代码“RewriteBase /”修复了它。

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %REQUEST_FILENAME -f [OR]
RewriteCond %REQUEST_FILENAME -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

但是,现在我遇到了一个新问题,即当我尝试使用 /wp-admin url 扩展名登录并填写我的凭据时,我被重定向到同一页面。

【讨论】:

以上是关于XAMPP + Wordpress:500 内部服务器错误的主要内容,如果未能解决你的问题,请参考以下文章

本地主机 xampp 上的 500 内部服务器错误

Xampp 上的 Symfony 项目返回 500 个内部服务器错误

apache xampp如何找到内部错误500的原因

Wordpress 仪表板登录内部 500 错误

Wordpress:500 内部服务器错误,可能是使用 $wpdb 的问题

wordpress程序安装时提示500错误