# Installation We have guides for installing LiteXiv on your [Nginx](#nginx) or [Apache](#apache) server. The following guides are based on Debian-based systems. Choose appropriate commands and packages for your own distro. (PHP >= 5.4 is required.) ## Nginx 1. Install `nginx`, `php` and `php-fpm` if you haven't: ```bash apt install nginx php php-fpm ``` 2. Clone and configure LiteXiv: ```bash cd /var/www git clone https://codeberg.org/Peaksol/LiteXiv.git nano LiteXiv/include/config.php ``` 3. Add the site to nginx (adjust the configuration as needed): ```bash nano /etc/nginx/sites-enabled/litexiv ``` ```nginx server { listen 8080; root /var/www/LiteXiv; index index.php; location ^~ /include/ { deny all; return 403; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php-fpm.sock; } location / { rewrite ^/proxy/(.*)$ /proxy.php?dest=$1 last; rewrite ^/en/(.*)$ /$1 permanent; rewrite ^/artworks/([0-9]*)$ /artworks/index.php?id=$1 last; rewrite ^/tags/(.*)$ /tags/index.php?q=$1 last; rewrite ^/users/([0-9]*)(/([^/]*)(/(.*))?)?$ /users/index.php?id=$1&category=$3&tag=$5 last; } } ``` 4. Restart nginx and php-fpm. The server should be up at configured address. ## Apache 1. Install `apache2`, `php` and `libapache2-mod-php` if you haven't: ```bash apt install apache2 php libapache2-mod-php ``` 2. Clone and configure LiteXiv: ```bash cd /var/www git clone https://codeberg.org/Peaksol/LiteXiv.git nano LiteXiv/include/config.php ``` 3. Add the site to apache2 (adjust the configuration as needed): ```bash nano /etc/nginx/sites-enabled/litexiv.conf ``` ```apache Listen 8080 ServerName localhost DocumentRoot /var/www/LiteXiv Order allow,deny Deny from all Require all granted RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^proxy/(.*)$ proxy.php?dest=$1 [QSA,L] RewriteRule ^en/(.*)$ $1 [QSA,R=301,L] RewriteRule ^artworks/([0-9]*)$ artworks/index.php?id=$1 [QSA,L] RewriteRule ^tags/(.*)$ tags/index.php?q=$1 [QSA,L] RewriteRule ^users/([0-9]*)(/([^/]*)(/(.*))?)?$ users/index.php?id=$1&category=$3&tag=$5 [QSA,L] ``` 4. Restart apache2. The server should be up at configured address. ## Other server software Installing for other server software (Caddy, Lighttpd, etc.) should be easy. While we don't have guides for them, the process should be as simple as configuring PHP to work with the server and adding some URI rules (see configurations for nginx and apache above).