Latest Ruby on Debian 8 with Multi‑Site

Setting up a Middleman client API container with Ruby and systemd, plus Nginx configuration for proxying requests.

Install Ruby and Middleman

rbenv global 2.3.3
ruby -v
echo "gem: --no-document" > ~/.gemrc
gem install bundler
gem install middleman

Startup service (systemd)

[Unit]
Description=Middleman client-api container

[Service]
User=www-data
Restart=always
WorkingDirectory=/var/www
ExecStart=/bin/bash -lc 'source /var/www/.bashrc ; cd /var/www/api/current ; bundle exec middleman server --port=4572 --watcher-force-polling --watcher-latency=1'

[Install]
WantedBy=default.target

Nginx configuration

server {
  listen 443 ssl;
  root /var/www/;
  ...

  location = /api {
    return 302 /api/;
  }

  location ~ ^/api(/?)(.*)$ {
    proxy_pass http://127.0.0.1:4572/$2$is_args$args;
  }

  ...
}
Human Logic, AI Syntax... Note on Content: I'm a Systems Engineer, not a native English writer. To ensure my technical ideas are clear and accessible, I use AI tools to polish the grammar and style. The workflow is simple: I provide the logic, the code, and the real-world experience. The AI handles the "English-to-Human" translation layer. If you find a bug, that's on me. If you find a perfectly placed comma, that's probably the AI.

Comments

Popular posts from this blog

FreeRadius with Google Workspace LDAP

Fixing pssh (parallel-ssh) Problems on Debian 10 with Python 3.7