Nova Resource:Wikisource/IA Upload

From Wikitech
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>
        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]

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


Set /etc/ImageMagick-6/policy.xml to have the following values (or larger):[1]

  <policy domain="resource" name="memory" value="2GiB"  />
  <policy domain="resource" name="map"    value="2GiB"  />
  <policy domain="resource" name="area"   value="256MB" />


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 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.

  1. See also Phabricator:T335332