You are browsing a read-only backup copy of Wikitech. The primary site can be found at wikitech.wikimedia.org

Nova Resource:Wikisource/IA Upload

From Wikitech-static
Jump to navigation Jump to search

This page documents how to set up a VPS for the IA Upload tool in the Wikisource project.

Web server

Install and configure Apache and PHP.

sudo apt install php php-common php-cli php-fpm php-json php-xml php-intl php-curl php-zip apache2 libapache2-mod-php composer imagemagick djvulibre-bin

Put the default Apache config in place:

/etc/apache2$ sudo mv apache2.conf apache2.conf.bak
/etc/apache2$ sudo mv apache2.conf.dpkg-dist apache2.conf
/etc/apache2$ sudo apache2ctl graceful

Create the web server configuration file at /etc/apache2/sites-available/ia-upload.conf with the following:

<VirtualHost *:80>
        ServerName ia-upload.wmcloud.org
        DocumentRoot /var/www/tool/public
        <Directory /var/www/tool/public/>
             Options Indexes FollowSymLinks
             AllowOverride All
             RewriteEngine On
             RewriteRule ^index\.php$ - [L]
             RewriteCond %{REQUEST_FILENAME} !-f
             RewriteCond %{REQUEST_FILENAME} !-d
             RewriteRule . /index.php [L]
        </Directory>
</VirtualHost>

Enable some Apache modules, and the web server configuration (and disable the default site, which isn't used):

sudo a2enmod php7.3 rewrite
sudo a2ensite ia-upload
sudo a2dissite 000-default
sudo apache2ctl graceful

Tool

Clone the repository, first removing the html/ directory created by Apache.

cd /var/www
sudo rm -rf html
sudo -- sudo -u www-data git clone https://github.com/wikisource/ia-upload.git tool

Install dependencies with Composer (this also will create the config.ini file):

sudo -- sudo -u www-data composer install --no-dev -o

Go and create a OAuth consumer on Meta Wiki, and add its key and secret to config.ini.