【发布时间】:2015-10-14 15:57:12
【问题描述】:
我最近开始从源代码编译一个灯栈。 Apache 是这样编译的:
./configure --prefix=/srv/www --enable-mods-shared=most
我可以通过将其放置在站点的虚拟主机中来确认 mod_rewrite 已启用: 重定向“/foo.html”“/bar.html”
但是,安装 wordpress 后,我可以登录 example.com/wp-login.php,但 example.com/wp-admin 会加载到有关重定向循环的错误页面。
我正在使用默认的 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
还有这个虚拟主机:
<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
包含 ProxyPassMatch 行以通过 php-fpm 处理 php。
如果需要,我可以包含 httpd.conf,但它有 506 行长,而且我听说 pastebin 在这里不受欢迎。我已经检查了该域的错误日志,并且在点击重定向循环时它没有得到更新,这似乎是一个非常简单的设置,除了使用 php-fpm 而不是 mod_rewrite,所以我有点迷路了在哪里进一步检查。
这是在 centos7 上编译的,所以 a2enmod 不是一个选项。
【问题讨论】:
标签: php wordpress apache mod-rewrite