Apache 2.4 + FPM + Wordpress多站点:URL重写在管理员中不起作用 [英] Apache 2.4 + FPM + Wordpress Multisite: URL Rewrite not working in admin

查看:98
本文介绍了Apache 2.4 + FPM + Wordpress多站点:URL重写在管理员中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚将Wordpress多站点从Apache 2.4 Prefork + mod_php移到了具有Apache 2.4 Event + php-fpm的新服务器上.

I just moved a Wordpress multi-site from a Apache 2.4 Prefork + mod_php to a new server with Apache 2.4 Event + php-fpm.

该站点在前端运行良好,由于使用了CGI,因此运行速度比以前快了很多,但是... Wordpress管理面板仅适用于主站点(和网络管理).第二个站点的管理区域不再可用,但是前端运行良好.

The site is working well on the frontend and it is a lot faster then before due to the CGI, but... the Wordpress administration panel is working just for the main site (and network administration). The admin area for the second site is no more working, but the frontend is working great.

示例

  • http://www.example.com/en/wp-admin/ => works
  • http://www.example.com/en/wp-admin/post-new.php => goes on error 404

我尝试调试重写,但是我拥有的唯一日志(也使用调试级别8)是

I tried to debug the rewrites, but the unique log I have (also using Debug Level 8) is

[proxy_fcgi:error] [pid 13700:tid 140381047965440] [client X.X.X.X:54354] AH01071: Got error 'Primary script unknown\n', referer: http://www.example.com/en/wp-admin/

关注我的配置.任何帮助表示赞赏.谢谢.

Follwing my configurations. Any help appreciated. Thank you.

虚拟主机

<VirtualHost *:80>
ServerName www.example.com
DocumentRoot "/srv/www/example.com/public_html"
<IfModule mpm_event_module>
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/srv/www/example.com/public_html/$1
</IfModule>
<Directory "/srv/www/example.com/public_html">
AllowOverride all
Require all granted
</Directory>
ErrorLog /srv/www/example.com/logs/error_log
TransferLog /srv/www/example.com/logs/access_log
</VirtualHost>

.htaccess

<Files "xmlrpc.php">
Order Allow,Deny
Deny from all
</Files>

# BEGIN WordPress
<IfModule mod_rewrite.c>
Options +FollowSymLinks

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-(admin|content|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+]/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
</IfModule>
# END WordPress

推荐答案

我添加了另一种解决方案,因为 @parpar的解决方案,尽管它对我有用,但仍会继续引发 proxy_fcgi 错误:

I add a different solution because @parpar's one, although it is working for me, it continues to throw proxy_fcgi errors:

[proxy_fcgi:error] Got error 'Primary script unknown\n'

该解决方案包括删除用于调用PHP FPM的ProxyPassMatch方法,并包括用于管理对 Directory 环境的PHP调用的处理程序:

The solution consists in removing the ProxyPassMatch way to call PHP FPM and including a handler to manage PHP calls into the Directory environment:

<Directory "/path/to/host/root">
   # rest of configuration...
   <FilesMatch \.php$>
      SetHandler "proxy:unix:/path/to/socket.sock|fcgi://localhost"
   </FilesMatch>
</Directory>

这篇关于Apache 2.4 + FPM + Wordpress多站点:URL重写在管理员中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆