This episode builds a web server and database stack on Devuan: nginx and Apache2 with PHP-FPM, MariaDB and PostgreSQL, then enables all services through the init system with service and update-rc.d so they run at boot.

Now it's time to build something real: a web server and database stack on Devuan. Episode 12 guides you through installing nginx and Apache2 as web servers, PHP-FPM for processing PHP, and MariaDB and PostgreSQL as databases. All of these services are enabled through the init system — the service and update-rc.d pattern from episode 5.
This is where Devuan's strength shows: there are no mysterious unit files. Every web and database service is a script in /etc/init.d/ that you can read, modify, and monitor directly. You'll understand exactly what's running on your server.
nginx is a popular choice for modern sites: lightweight, fast for static files, and efficient as a reverse proxy. Install and run it:
sudo apt update
sudo apt install nginx
sudo service nginx start
sudo service nginx statussudo service nginx start starts the nginx daemon. Verify it by opening http://localhost in a browser or with curl:
curl -I http://localhostAn HTTP/1.1 200 OK response from curl -I http://localhost means nginx is running. The default document root is /var/www/html/.
Apache2 is the classic web server, very flexible through modules and .htaccess files:
sudo apt install apache2
sudo service apache2 start
sudo a2enmod rewrite
sudo service apache2 restarta2enmod rewrite enables the rewrite module — often needed by web applications. After changing modules, restart Apache so the changes take effect.
PHP-FPM runs PHP as a separate service that talks to the web server over a FastCGI socket:
sudo apt install php-fpm
sudo service php-fpm startsudo service php-fpm start starts the php-fpm daemon. Pool configuration lives in /etc/php/*/fpm/pool.d/ — this is where you set the user, socket, and execution limits.
An example nginx server block that forwards PHP requests to php-fpm:
server {
listen 80;
root /var/www/lab;
index index.php index.html;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php-fpm.sock;
}
}Enable the site and test:
sudo ln -s /etc/nginx/sites-available/lab /etc/nginx/sites-enabled/
sudo service nginx reloadsudo service nginx reload reloads the configuration without dropping connections — a smoother practice than a restart.
MariaDB is a stable MySQL derivative, popular for web applications:
sudo apt install mariadb-server
sudo service mariadb start
sudo mysql_secure_installationsudo mysql_secure_installation guides you through setting the root password, removing anonymous users, and the test database. After that, create a database and user:
sudo mariadb -e "CREATE DATABASE labdb;"
sudo mariadb -e "CREATE USER 'lab'@'localhost' IDENTIFIED BY 'rahasia';"
sudo mariadb -e "GRANT ALL ON labdb.* TO 'lab'@'localhost';"PostgreSQL offers advanced features and strong data integrity:
sudo apt install postgresql
sudo service postgresql start
sudo -u postgres createuser --interactivesudo service postgresql start starts the PostgreSQL cluster. To create a new database and user, use sudo -u postgres createdb labdb then log in with psql.
To keep the stack alive after a reboot, enable auto-start for each service:
sudo update-rc.d nginx enable
sudo update-rc.d php-fpm enable
sudo update-rc.d mariadb enableupdate-rc.d nginx enable creates symlinks in /etc/rcN.d/ so nginx boots with the system. Verify all services are running after a reboot with service --status-all.
Episode 12 built a web server and database stack on Devuan: nginx and Apache2 as web servers, PHP-FPM for PHP processing, and MariaDB and PostgreSQL for data storage — all managed and enabled through the init system.
Key takeaways:
sudo service nginx reload reloads without dropping connections.mysql_secure_installation secures MariaDB from its defaults.update-rc.d enables services to start at boot.In the next episode, episode 13, we'll cover firewall: nftables and iptables — building an nftables ruleset, understanding the difference from iptables, enabling UFW, and configuring IP forwarding, NAT, and a gateway on Devuan.