简体   繁体   English

wp-admin中的wordpress重定向循环(从源​​代码编译的Apache)

[英]wordpress redirect loop in wp-admin (apache compiled from source)

I recently set out to compile a lamp stack from source. 我最近着手从源头编译一个灯堆。 Apache was compiled like so: Apache的编译方式如下:

./configure --prefix=/srv/www --enable-mods-shared=most ./configure --prefix = / srv / www --enable-mods-shared = most

and I can confirm mod_rewrite is enabled by placing this in the vhost for a site: Redirect "/foo.html" "/bar.html" 并且可以通过将mod_rewrite放置在网站的虚拟主机中来确认启用了mod_rewrite:重定向“ /foo.html”“ /bar.html”

However, after installing wordpress, I can log in at example.com/wp-login.php, but example.com/wp-admin loads to an error page about a redirect loop. 但是,安装了wordpress之后,我可以登录example.com/wp-login.php,但是example.com/wp-admin会加载到有关重定向循环的错误页面上。

I'm using the default wordpress htaccess file: 我正在使用默认的wordpress htaccess文件:

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

and this vhost: 和这个虚拟主机:

<VirtualHost *:80>
    ServerName example.com
    DocumentRoot "/srv/www/htdocs/example.com"
    <Directory "/srv/www/htdocs/example.com">
    options indexes followSymLinks
            # AllowOverride controls what directives may be placed in .htaccess files.      
            AllowOverride All
            # Controls who can get stuff from this server file
            require all granted
    rewriteEngine on
    </Directory>
    <IfModule mpm_peruser_module>
            ServerEnvironment apache apache
    </IfModule>
    ErrorLog  /srv/www/logs/example.com/error_log
    CustomLog /srv/www/logs/example.com/access_log combined
</VirtualHost>
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/srv/www/htdocs/example.com/$1
DirectoryIndex /index.php index.php

The ProxyPassMatch line is included to handle php via php-fpm. 包括ProxyPassMatch行以通过php-fpm处理php。

I can include the httpd.conf if needed, but it's 506 lines long and I hear pastebin isn't received warmly here. 如果需要,我可以包含h​​ttpd.conf,但是它的长度为506行,而且我听说这里没有热情地收到pastebin。 I've checked the error log for that domain and it doesn't get updated when hitting the redirect loop, and it seems like a pretty straightforward setup with the exception of using php-fpm instead of mod_rewrite, so I'm a bit lost on where to check further. 我已经检查了该域的错误日志,并且在遇到重定向循环时它没有得到更新,而且看起来很简单,只是使用了php-fpm而不是mod_rewrite,所以我有点迷失了在哪里进一步检查。

This was compiled on centos7 so a2enmod isn't an option. 这是在centos7上编译的,因此a2enmod不是一个选择。

DirectoryIndex /index.php index.php

This was the issue. 这就是问题所在。

DirectoryIndex index.php

This was the solution. 这就是解决方案。 After removing /index.php from the directoryindex directive, the site loads and the dashboard loads without issue as well. 从directoryindex指令中删除/index.php之后,该站点将加载,并且仪表板也将加载而不会出现问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM