MediaWiki help
Maintenance
MediaWiki:Common.css
MediaWiki:Mainpage
https://www.mediawiki.org/wiki/Special:ExtensionDistributor
User creation
php maintenance/run.php createAndPromote Nombre_del_usuario Clave_del_usuario --sysop --bureaucrat --interface-admin
Visualización de algunas páginas en un wiki privado para usuarios sin cuentas
Colocar la siguiente orden en el LocalSettings.php http://stackoverflow.com/questions/18255768/how-to-deny-access-to-all-pages-and-allow-only-for-certain-on-wiki
# allow everyone read access to these pages: $wgWhitelistRead = array( "Main Page", "Public stuff" );
Page editing help
Color text ★
<span style="color:#5fe8e6;">Color text ★</span>
def quick_sort(arr):
less = []
pivot_list = []
more = []
if len(arr) <= 1:
return arr
<syntaxhighlight lang="python" line start="3" highlight="1,5-7" copy> </ syntaxhighlight>
MediaWiki Installation
https://www.mediawiki.org/wiki/Manual:Installing_MediaWiki
Create the DNS records
Go to AWS > Route 53 > Hosted zones > sinfrontera.net: Type A:
- Name: wiki.sinfrontera.net
- Value: your IP
Type CNAME (optional):
- Name: www.wiki.sinfrontera.net
- Value: wiki.sinfrontera.net
Download the MediaWiki software from the official download page: https://www.mediawiki.org/wiki/Download and extract it at
[Note that /var/www/ will exist only if Apache is installed]
cd /var/www/sinfronteras/mediawiki
sudo chown -R ubuntu:ubuntu /var/www/sinfronteras
chmod 755 /var/www/sinfronteras
wget https://releases.wikimedia.org/mediawiki/1.45/mediawiki-1.45.1.tar.gz
tar xvzf mediawiki-1.45.1.tar.gz
Apache
sudo apt update
sudo apt install apache2
sudo systemctl status apache2 # Check that Apache is running
sudo systemctl start apache2 # If it is not running, start it
# Configure the port Apache will listen to and the DocumentRoot
sudo vi /etc/apache2/ports.conf
Listen 8082 # Port 80 will be used by Nginix
sudo vi /etc/apache2/sites-available/000-default.conf
<VirtualHost *:8082> # We set 8082 as the default port. Then we'll configure Nginx so we can access Apache-served sites from port 80
DocumentRoot /var/www/sinfronteras
sudo vi /etc/apache2/sites-available/wiki.sinfrontera.net.conf
<VirtualHost *:8082>
ServerName wiki.sinfrontera.net
ServerAlias www.wiki.sinfrontera.net
ServerAdmin webmaster@localhost
DocumentRoot /var/www/sinfronteras/mediawiki
<Directory /var/www/sinfronteras/mediawiki>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/wiki_error.log
CustomLog ${APACHE_LOG_DIR}/wiki_access.log combined
</VirtualHost>
sudo a2ensite wiki.sinfrontera.net.conf
sudo apachectl configtest
sudo systemctl reload apache2
sudo systemctl restart apache2
http://your_server_ip:8082 # Test Apache in your browser
Adding HTTPS with Let’s Encrypt
sudo certbot --nginx -d wiki.sinfrontera.net -d www.wiki.sinfrontera.net
# The following is not mandatory. It is only to ensure everything is ok so the certificate will renew:
sudo certbot renew --dry-run
systemctl list-timers | grep certbot # This should display something like "certbot.timer
Nginx
sudo apt install nginx -y
sudo systemctl start nginx
sudo systemctl enable nginx
sudo systemctl status nginx
sudo rm /etc/nginx/sites-enabled/default # If nothing has already been configured on "default"
sudo vi /etc/nginx/sites-available/wiki.sinfrontera.net
server {
listen 443 ssl http2;
server_name wiki.sinfrontera.net www.wiki.sinfrontera.net;
client_max_body_size 50M; # Maximum file size loaded from MediaWiki
# Short URLs: /view/Page instead of /index.php?title=Page
location ^~ /view/ {
rewrite ^/view/(.*)$ /index.php?title=$1 last;
}
ssl_certificate /etc/letsencrypt/live/wiki.sinfrontera.net/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/wiki.sinfrontera.net/privkey.pem;
location / {
proxy_pass http://127.0.0.1:8082;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
server {
listen 80;
server_name wiki.sinfrontera.net www.wiki.sinfrontera.net;
return 301 https://$host$request_uri;
}
sudo ln -s /etc/nginx/sites-available/wiki.sinfrontera.net /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
sudo systemctl restart nginx # Only if reload fails or Nginx behaves oddly
MySQL
sudo apt install mysql-server
sudo systemctl start mysql
sudo systemctl status mysql
sudo mysql_secure_installation
* Use VALIDATE PASSWORD plugin? : No
* Remove anonymous users? : Yes
* Disallow root login remotely? : Yes
* Remove test database and access to it? : Yes
* Reload privilege tables now? : Yes
# Configuring the root password
sudo mysql
ALTER USER 'root'@'localhost'
IDENTIFIED WITH mysql_native_password
BY 'Enter_password_here';
FLUSH PRIVILEGES;
EXIT;
# Creating the wiki database
mysql -u root -p
CREATE DATABASE wikidb;
PHP
sudo apt install php libapache2-mod-php
php -v
sudo apt install php-cli php-common php-mysql php-curl php-xml php-mbstring php-zip php-gd
sudo apt install php-intl php-apcu
sudo systemctl restart apache2
Tamaño máximo de los archivos cargados en el wiki
https://www.mediawiki.org/wiki/Manual:Configuring_file_uploads/fr#Set_maximum_size_for_file_uploads
If you are using mod_php (most common), the most likely locations for the correct php.ini file are:
/etc/php/8.0/apache2/php.ini /etc/php5/apache2/php.ini
post_max_size = 8M # I've modified it to be 50M upload_max_filesize = 2M # 50M
Run the MediaWiki configuration script https://www.mediawiki.org/wiki/Manual:Config_script
From the web browser
- Open a web browser and browse to the website address or path that you configured for MediaWiki and follow the instructions on the pages to connect to the database, create the MediaWiki administrator account, and to set further settings.
- After the configuration script has finished, download the generated configuration file LocalSettings.php and place the file in the base directory of your MediaWiki installation.
From Command-line:
- Creates a new
LocalSettings.phpusing CLI parameters. See https://www.mediawiki.org/wiki/Manual:Install.php - Uses an existing
LocalSettings.phpfile to retrieve configuration. See https://www.mediawiki.org/wiki/Manual:InstallPreConfigured.php
php maintenance/run.php installPreConfigured [OPTION]...
# Create users php maintenance/run.php createAndPromote Nombre_del_usuario Clave_del_usuario --sysop --bureaucrat --interface-admin
Allow image uploading
sudo chown -R www-data:www-data images # This is the images dir in the MediaWiki dir
sudo chmod -R 755 images
Logo and FavIcon
Place the images at the following location and update LocalSettings.php
$wgLogos = [
'1x' => "$wgResourceBasePath/resources/assets/sinfronteras_logo_white_1.png",
'icon' => "$wgResourceBasePath/resources/assets/sinfronteras_logo_white_1.png",
];
$wgFavicon = "$wgScriptPath/resources/assets/sinfronteras_favicon_blue.png"; # It must be 48x48 pixels
Finally, configure LocalSettings.php to match your preferences and include extensions.
Configurations
Rewrites the URL and hide the index.php file from the page URL
Luego de instalar MediaWiki, la URL de mis páginas era: http://wiki.sinfronteras.ws/index.php/Python. El index.php no es apropiado. Esta url se puede rewrite de la forma explicada aquí: https://www.mediawiki.org/wiki/Manual:Short_URL. Sin embargo, vamos a aborda un método más simple usando Nginx.
Mi idea era configurar las url de esta forma: http://wiki.sinfronteras.ws/Python. Sin embargo en https://www.mediawiki.org/wiki/Manual:Short_URL se explica que esta configuración no es la más apropiada. Ver: https://www.mediawiki.org/wiki/Manual:Short_URL#URL_like_subdomain https://www.mediawiki.org/wiki/Manual:Wiki_in_site_root_directory
Se recomienda entonces colocar alguna palagra en la ruta. Por ejemplo: http://wiki.sinfronteras.ws/view/Python
sudo vi /etc/nginx/sites-available/wiki.sinfrontera.net
server {
listen 80;
server_name wiki.sinfrontera.net www.wiki.sinfrontera.net;
client_max_body_size 50M; # Maximum file size loaded from MediaWiki
# Short URLs: /view/Page instead of /index.php?title=Page
location ^~ /view/ {
rewrite ^/view/(.*)$ /index.php?title=$1 last;
}
# Proxy everything to Apache
location / {
proxy_pass http://127.0.0.1:8082;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
vi LocalSettings.php
$wgScriptPath = "";
$wgServer = "http://wiki.sinfrontera.net";
$wgArticlePath = "/view/$1";
$wgUsePathInfo = true;
sudo nginx -t
sudo systemctl reload nginx
Extensions
https://www.mediawiki.org/wiki/Special:ExtensionDistributor
Syntaxhighlight
https://www.mediawiki.org/wiki/Extension:SyntaxHighlight
CREATE DATABASE my_wiki;
CREATE USER 'wikiuser'@'localhost' IDENTIFIED BY 'database_password';
GRANT ALL PRIVILEGES ON my_wiki.* TO 'wikiuser'@'localhost' WITH GRANT OPTION;
Referencias cruzadas entre Figuras, Tablas, etc
Extension Figures
https://www.mediawiki.org/wiki/Extension:Figures