Apache 2.4 + FPM + Wordpress多站点:URL重写在管理员中不起作用

编程入门 行业动态 更新时间:2024-10-23 14:33:45
本文介绍了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.

示例

  • www.example/en/wp-admin/ =>有效
  • www.example/en/wp-admin/post-new.php =>出现错误404
  • www.example/en/wp-admin/ => works
  • www.example/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: www.example/en/wp-admin/

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

Follwing my configurations. Any help appreciated. Thank you.

虚拟主机

<VirtualHost *:80> ServerName www.example DocumentRoot "/srv/www/example/public_html" <IfModule mpm_event_module> ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/srv/www/example/public_html/$1 </IfModule> <Directory "/srv/www/example/public_html"> AllowOverride all Require all granted </Directory> ErrorLog /srv/www/example/logs/error_log TransferLog /srv/www/example/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重写在管理员中不起作用

本文发布于:2023-11-01 23:14:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1550688.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:写在   中不   管理员   站点   Apache

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!