带有子目录的 Wordpress 多站点。phpmyadmin 不工作

Wordpress multisite with subdirectory. phpmyadmin is not working

提问人:igalsc 提问时间:9/14/2023 最后编辑:Isaac Bennetchigalsc 更新时间:9/17/2023 访问量:29

问:

我已将 Wordpress 多站点配置为使用子目录。

所有站点都使用相同的子目录 URL。 所有这些都是从 ./var/www/multisite

一切正常,包括 /wp-admin,但是当我尝试访问 phpadmin 时,我得到空白页。在 Chrome 网络检查器中,我可以看到找不到 phpmyadmin 源。

这是我的.htaccess文件

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

# Allow direct access to phpMyAdmin directory
RewriteCond %{REQUEST_URI} !^/blog/phpmyadmin [NC]

# Handle /wp-admin/ requests for main site and subdirectories
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} ^/(blog/)?wp-admin [NC]
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Handle /blog/ requests for subdirectories
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^blog/(.*)$ /var/www/multisite/$1 [L]

# WordPress default rules for main site and subdirectories
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
</IfModule>
# END WordPress

# Wordfence WAF (keep this section separate)
<IfModule mod_php5.c>
    php_value auto_prepend_file '/var/www/multisite/wordfence-waf.php'
</IfModule>
<IfModule mod_php7.c>
    php_value auto_prepend_file '/var/www/multisite/wordfence-waf.php'
</IfModule>
<IfModule mod_php.c>
    php_value auto_prepend_file '/var/www/multisite/wordfence-waf.php'
</IfModule>
<Files ".user.ini">
<IfModule mod_authz_core.c>
    Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
    Order deny,allow
    Deny from all
</IfModule>
</Files>
# END Wordfence WAF

Apache错误日志中没有错误,但我在Apache访问日志中看到了这一点:

10.7.0.113 - - [13/Sep/2023:18:38:13 +0000] "GET /blog/phpmyadmin/index.php HTTP/1.1" 200 5308 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
10.7.0.113 - - [13/Sep/2023:18:38:14 +0000] "GET /blog/phpmyadmin/js/whitelist.php?v=4.9.5deb2&lang=en HTTP/1.1" 200 1229 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
10.7.0.113 - - [13/Sep/2023:18:38:14 +0000] "GET /blog/phpmyadmin/phpmyadmin.css.php?nocache=4755212520ltr&server=1 HTTP/1.1" 200 21572 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
10.7.0.113 - - [13/Sep/2023:18:38:14 +0000] "GET /blog/phpmyadmin/js/vendor/codemirror/lib/codemirror.css?v=4.9.5deb2 HTTP/1.1" 404 23968 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
10.7.0.113 - - [13/Sep/2023:18:38:14 +0000] "GET /blog/phpmyadmin/themes/pmahomme/jquery/jquery-ui.css HTTP/1.1" 404 42835 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
10.7.0.113 - - [13/Sep/2023:18:38:14 +0000] "GET /blog/phpmyadmin/js/keyhandler.js?v=4.9.5deb2 HTTP/1.1" 404 23968 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
10.7.0.113 - - [13/Sep/2023:18:38:14 +0000] "GET /blog/phpmyadmin/js/vendor/sprintf.js?v=4.9.5deb2 HTTP/1.1" 404 23968 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
10.7.0.113 - - [13/Sep/2023:18:38:14 +0000] "GET /blog/phpmyadmin/js/vendor/codemirror/addon/lint/lint.css?v=4.9.5deb2 HTTP/1.1" 404 23968 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"

这是我的

/etc/phpmyadmin/apache.conf

# phpMyAdmin default Apache configuration

Alias /phpmyadmin /usr/share/phpmyadmin

<Directory /usr/share/phpmyadmin>
    Options SymLinksIfOwnerMatch
    DirectoryIndex index.php

    # limit libapache2-mod-php to files and directories necessary by pma
    <IfModule mod_php7.c>
        php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
        php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/php/php-php-gettext/:/usr/share/javascript/:/usr/share/php/tcpdf/:/usr/share/doc/phpmyadmin/:/usr/share/php/phpseclib/:/usr/share/php/PhpMyAdmin/:/usr/share/php/Symfony/:/usr/share/php/Twig/:/usr/share/php/Twig-Extensions/:/usr/share/php/ReCaptcha/:/usr/share/php/Psr/Container/:/usr/share/php/Psr/Cache/:/usr/share/php/Psr/Log/:/usr/share/php/Psr/SimpleCache/
    </IfModule>

</Directory>

# Disallow web access to directories that don't need it
<Directory /usr/share/phpmyadmin/templates>
    Require all denied
</Directory>
<Directory /usr/share/phpmyadmin/libraries>
    Require all denied
</Directory>

这是我为主站点编辑的虚拟主机:

<VirtualHost *:80>
        ServerAdmin [email protected]
        ServerName domain.com
        DocumentRoot /var/www/multisite
        DirectoryIndex index.php

        # Add a RewriteRule to handle subdirectory structure
        RewriteEngine On
        RewriteRule ^/blog(.*)$ /$1 [L]

        <Directory /var/www/multisite>
          Options -Indexes +FollowSymLinks +MultiViews
          AllowOverride All
          Order allow,deny
          allow from all
        </Directory>

        # Alias for phpMyAdmin
        Alias /phpmyadmin /usr/share/phpmyadmin
        <Directory /usr/share/phpmyadmin>
          Options -Indexes +FollowSymLinks
          DirectoryIndex index.php
          Require all granted
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/multisite.domain.com-error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel error

        CustomLog ${APACHE_LOG_DIR}/multisite.domain.com-access.log combined
</VirtualHost>

wordpress apache 子目录

评论


答: 暂无答案