- Install Nginx, MariaDB, and PHP:
sudo apt update sudo apt install nginx mariadb-server php php-fpm php-mbstring php-xml php-json php-mysql php-curl php-intl php-gd php-mbstring texlive imagemagick unzip -y
- Configure MariaDB:
sudo mysql_secure_installation sudo mysql -u root -p
Inside the MariaDB shell:
CREATE DATABASE wikidb; GRANT ALL PRIVILEGES ON wikidb.* TO 'wikiuser'@'localhost' IDENTIFIED BY 'password'; FLUSH PRIVILEGES; EXIT;
- Download and Configure MediaWiki:
cd /var/www/html wget https://releases.wikimedia.org/mediawiki/1.31/mediawiki-1.31.0.tar.gz tar xvf mediawiki-1.31.0.tar.gz mv mediawiki-1.31.0 mediawiki sudo chown -R www-data:www-data /var/www/html/mediawiki
- Configure Nginx: Create a new Nginx configuration file:
sudo nano /etc/nginx/conf.d/wiki.conf
Add the following content:
server { listen 80; server_name wiki.example.com; root /var/www/html/mediawiki; index index.php; error_log /var/log/nginx/mediawiki.error; access_log /var/log/nginx/mediawiki.access; location / { try_files $uri $uri/ /index.php; } location ~ \.php$ { fastcgi_pass unix:/run/php/php7.4-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; include snippets/fastcgi-php.conf; } location ~ /\.ht { deny all; } }
Test and restart Nginx:
sudo nginx -t sudo systemctl restart nginx
- Secure with Let's Encrypt: Install Certbot:
sudo apt install certbot python3-certbot-nginx -y
Obtain and install the SSL certificate:
sudo certbot --nginx -d wiki.example.com
- Finalize MediaWiki Installation:
Open your browser and navigate to
http://wiki.example.com
to complete the MediaWiki setup through the web interface.
No comments:
Post a Comment