Migrate Mediawiki: Difference between revisions

From Creative Crowds wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 20: Line 20:
Download Mediawiki from the website
Download Mediawiki from the website


into the folder: <code>/opt/</code>, rename folder to <code>wiki</code>
into the folder: <code>/var/www/</code>, rename folder to <code>wiki</code>


  chown -R www-data:www-data /opt/wiki/
  chown -R www-data:cc /var/www/wiki/
  chmod -R 755 /opt/wiki/
  chmod -R 755 /var/www/wiki/


Configure nginx
Configure nginx


<pre>
<pre>
# ---------------------------------------------------
        # ---------------------------------------------------
# WIKI  
        # WIKI  


location /wiki/ {
        # Handling for the article path (pretty URLs)
        root /opt/;
        location /wiki {
        index index.php;
                index index.php;
        location ~ \.php$ {
                 rewrite ^/wiki/(?<pagename>.*)$ /wiki/index.php;
                 include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/run/php/php8.4-fpm.sock;
                include fastcgi_params;
         }
         }
}
        # Images
        location /wiki/images/deleted {
                # Deny access to deleted images folder
                deny all;
        }
        # MediaWiki assets (usually images)
        location ~ ^/wiki/resources/(assets|lib|src) {
                try_files $uri 404;
                add_header Cache-Control "public";
                expires 7d;
        }
        # Assets, scripts and styles from skins and extensions
        location ~ ^/wiki/(skins|extensions)/.+\.(css|js|gif|jpg|jpeg|png|svg|wasm)$ {
                try_files $uri 404;
                add_header Cache-Control "public";
                expires 7d;
        }
        # License and credits files
        location ~ ^/wiki/(COPYING|CREDITS)$ {
                default_type text/plain;
        }
 
</pre>
</pre>
(More stuff needs to be added.. later)


Migrate the database
Migrate the database

Revision as of 09:41, 16 January 2026

sudo su
apt install mariadb-server imagemagick
mysql
CREATE USER 'wiki'@'localhost' IDENTIFIED BY 'INSERTPASSWORDHERE';
CREATE DATABASE wikidb;
GRANT ALL PRIVILEGES ON wikidb.* TO 'wiki'@'localhost';
FLUSH PRIVILEGES;
EXIT;
apt install php php-fpm php-mysql php-xml php-intl php-mbstring php-gd php-curl

Download Mediawiki from the website

into the folder: /var/www/, rename folder to wiki

chown -R www-data:cc /var/www/wiki/
chmod -R 755 /var/www/wiki/

Configure nginx

        # ---------------------------------------------------
        # WIKI 

        # Handling for the article path (pretty URLs)
        location /wiki {
                index index.php;
                rewrite ^/wiki/(?<pagename>.*)$ /wiki/index.php;
        }
        # Images
        location /wiki/images/deleted {
                # Deny access to deleted images folder
                deny all;
        }
        # MediaWiki assets (usually images)
        location ~ ^/wiki/resources/(assets|lib|src) {
                try_files $uri 404;
                add_header Cache-Control "public";
                expires 7d;
        }
        # Assets, scripts and styles from skins and extensions
        location ~ ^/wiki/(skins|extensions)/.+\.(css|js|gif|jpg|jpeg|png|svg|wasm)$ {
                try_files $uri 404;
                add_header Cache-Control "public";
                expires 7d;
        }
        # License and credits files
        location ~ ^/wiki/(COPYING|CREDITS)$ {
                default_type text/plain;
        }

Migrate the database

Following this: https://www.mediawiki.org/wiki/Manual:Restoring_a_wiki_from_backup

Worked

Then this error appeared: Class "Wikimedia\Parsoid\DOM\HTMLDocument" not found

Followed this: https://phabricator.wikimedia.org/T409283

Worked!

Done