直接在php8.5-fpm上安裝mediawiki

回覆文章
Brave Ye
系統管理員
文章: 5001
註冊時間: 2025-11-08, 13:32
聯繫:

直接在php8.5-fpm上安裝mediawiki

文章 Brave Ye »

如果你裝mediawiki 1.45.4 以上更新版本仍顯示1.45.3
sudo a2disconf mediawiki
sudo systemctl restart php8.5-fpm
nano /etc/apache2/conf-available/mediawiki.conf

代碼: 選擇全部

    

    # Map the /w URL path to the /var/www/html/w directory [Short URLs]
    Alias /w /var/www/html/w

    <Directory /var/www/html/w>
        Options FollowSymLinks
        AllowOverride All
        Require all granted

        # Forward PHP requests inside /w to PHP 8.5-FPM
        <FilesMatch \.php$>
            SetHandler "proxy:unix:/run/php/php8.5-fpm.sock|fcgi://localhost"
        </FilesMatch>
    </Directory>

    <Directory /var/lib/mediawiki>
        Options FollowSymLinks
        AllowOverride All
        Require all granted

        <FilesMatch \.php$>
            SetHandler "proxy:unix:/run/php/php8.5-fpm.sock|fcgi://localhost"
        </FilesMatch>
    </Directory>
    # --- SECURITY HARDENING: Prevent arbitrary PHP execution in uploads ---

    # Block PHP in your main MediaWiki upload folder
    <Directory /var/lib/mediawiki/images>
        # Turn off the proxy handler for PHP files inside this directory
        <FilesMatch \.php$>
            SetHandler none
            Require all denied
        </FilesMatch>
        
        # Override mod_php if it ever accidentally gets turned on globally
        <IfModule mod_php.c>
            php_admin_flag engine off
        </IfModule>
    </Directory>



    # Short URL Rewriting Engine
#    RewriteEngine On
#    RewriteRule ^/wiki/(.*)$ /w/index.php?title=$1 [PT,L,QSA]
#    RewriteRule ^/wiki$ /w/index.php [PT,L,QSA]
sudo a2enconf mediawiki
sudo systemctl restart php8.5-fpm
systemctl restart apache2
回覆文章

誰在線上

正在瀏覽這個版面的使用者:沒有註冊會員 和 2 位訪客