IPv4 & IPv6 Leasing - Any RIR, Any LocationOrder Now
Hostperl

Secure OpenAI-Compatible Model Serving on openSUSE Leap

By Raman Kumar

Share:

Updated on Nov 21, 2026

Secure OpenAI-Compatible Model Serving on openSUSE Leap

What you are building

This tutorial shows you how to run OpenAI-compatible model serving on openSUSE Leap for a private production workload. You will create a non-root admin account, install the runtime, expose the service safely through firewalld, bind it to localhost behind Nginx, and verify API access with a signed request.

The goal is simple: a private endpoint for internal apps, agents, or testing tools without exposing your model port directly to the internet.

If you are buying the server for this workload, a well-sized Hostperl VPS is a solid starting point for moderate inference, staging, and API integration work. For larger models or higher concurrency, Hostperl’s dedicated server hosting gives you more predictable CPU, memory, and storage headroom.

This guide uses openSUSE Leap because it is the least-covered OS track in this rotation, and the stack is fully supported there. If you are planning GPU inference or larger private deployments, the same hardening pattern also fits the operational advice in Secure Private AI Model Serving on Ubuntu Server 24.04, but the commands below are specific to openSUSE Leap.

Connect to the server and confirm the operating system

On your local computer, connect to the VPS first. The IP below is documentation-only. Replace 203.0.113.10 with the public IP assigned to your server.

ssh root@203.0.113.10

If your provider gives you a default non-root login, use that account instead, then elevate with sudo. Keep the original root session open until the new account is tested and working.

On the VPS as root, check the platform before you change anything:

cat /etc/os-release

You should see openSUSE Leap in the output. If you do not, stop and follow the matching procedure for your distribution.

Create a non-root administrator and test sudo

Production servers should not be managed from a root shell all day. Create a sudo-capable admin account named deploy, copy your SSH key, and test a second login before you lock down root access.

On the VPS as root, create the account and set its initial password:

useradd -m -s /bin/bash deploy
passwd deploy

Next, give the user sudo rights. On openSUSE Leap, membership in wheel is the usual pattern.

usermod -aG wheel deploy

Create the SSH directory and install your public key. Replace the sample key file path with the location of your own public key on your local machine. If you are copying from another root shell, paste the contents carefully.

install -d -m 700 -o deploy -g deploy /home/deploy/.ssh
cat >> /home/deploy/.ssh/authorized_keys

Paste your public key, then press Ctrl+D to save. Finish by locking down ownership and permissions:

chown -R deploy:deploy /home/deploy/.ssh
chmod 700 /home/deploy/.ssh
chmod 600 /home/deploy/.ssh/authorized_keys

On your local computer, open a second terminal and test the new account. Do not close the root session yet.

ssh deploy@203.0.113.10

Then check sudo access:

sudo -v

If you see no errors and the password prompt succeeds, the admin account is ready. Only after this step should you consider disabling root SSH login later in the guide.

Install the OpenAI-compatible model serving runtime on openSUSE Leap

This tutorial uses an OpenAI-compatible HTTP API server pattern rather than a consumer chatbot UI. That keeps the server useful for internal apps, testing harnesses, and private integrations.

On the VPS as the non-root sudo user, update package metadata and install the tooling needed for service management, firewall control, and Nginx reverse proxying:

sudo zypper refresh
sudo zypper install -y curl git nginx firewalld

Now check the installed versions so you know what you are operating:

nginx -v
firewall-cmd --version

For the model server itself, use your selected runtime package or binary. Because private model stacks vary by model family and hardware, this tutorial keeps the serving layer generic and focuses on the production controls around it.

Place the runtime under /opt/myapp, which keeps application files separate from the OS packages.

sudo mkdir -p /opt/myapp/bin /opt/myapp/models /opt/myapp/logs
sudo chown -R deploy:deploy /opt/myapp

In a real deployment, you would place your model server binary or container entrypoint in /opt/myapp/bin and point it at the model directory. If you already have a service binary, copy it there now and make it executable.

The most important part for this guide is that the API binds to 127.0.0.1:8000 so only Nginx can reach it.

Set up a systemd service for the API server

Running the model server under systemd gives you restart control, logs, and reboot persistence. Create an environment file first so secrets and runtime options stay out of the unit file.

On the VPS as root, create the environment file:

install -d -m 750 /etc/myapp
cat > /etc/myapp/model-serving.env

Use this sample content, then save the file:

MODEL_HOST=127.0.0.1
MODEL_PORT=8000
MODEL_API_KEY=replace-with-a-long-random-secret
MODEL_LOG_LEVEL=info

Press Ctrl+D to finish. Lock down the file so only root can read it:

chmod 600 /etc/myapp/model-serving.env

Now create the systemd unit file:

cat > /etc/systemd/system/model-serving.service

Use this unit content:

[Unit]
Description=Private OpenAI-Compatible Model Serving
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
User=deploy
Group=deploy
EnvironmentFile=/etc/myapp/model-serving.env
WorkingDirectory=/opt/myapp
ExecStart=/opt/myapp/bin/model-server --host ${MODEL_HOST} --port ${MODEL_PORT} --api-key ${MODEL_API_KEY} --log-level ${MODEL_LOG_LEVEL}
Restart=on-failure
RestartSec=5
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=full
ProtectHome=true
ReadWritePaths=/opt/myapp /var/log

[Install]
WantedBy=multi-user.target

Save the file with Ctrl+D. Before starting it, reload systemd so it sees the new unit:

systemctl daemon-reload
systemctl enable --now model-serving.service

Check status immediately. A healthy service should show active (running).

systemctl status model-serving.service --no-pager
journalctl -u model-serving.service -n 50 --no-pager

Bind the API to localhost and protect the port

The model process should not listen on the public interface. Confirm the socket is local only:

ss -tulpn | grep 8000

You want to see 127.0.0.1:8000, not 0.0.0.0:8000. If it is bound publicly, fix the service arguments before continuing.

Enable firewalld and open only web traffic for the reverse proxy. Do not expose port 8000 directly.

sudo systemctl enable --now firewalld
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload
sudo firewall-cmd --list-all

This keeps the API reachable through Nginx while the backend stays private on localhost. If you later add SSH rules or a custom management port, test the new rule first, then remove the old one.

Configure Nginx as the public front end

Reverse proxying is the cleanest way to add TLS, logging, and request controls without exposing the model port. Use a dedicated server block that points to the local API and passes authorization headers correctly.

On the VPS as root, create the site config:

cat > /etc/nginx/conf.d/model-serving.conf

Use this configuration, replacing server.example.com with your real hostname and example.com with your actual domain:

server {
    listen 80;
    server_name server.example.com;

    access_log /var/log/nginx/model-serving.access.log;
    error_log /var/log/nginx/model-serving.error.log;

    location / {
        proxy_pass http://127.0.0.1:8000;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_read_timeout 300s;
        proxy_connect_timeout 30s;
        proxy_send_timeout 300s;
    }
}

Save the file, then test the syntax before reloading Nginx:

nginx -t
systemctl reload nginx

If the syntax test fails, read the error line number and correct the config before reloading. A working syntax test should report successful.

Start and enable Nginx if it is not already active:

systemctl enable --now nginx
systemctl status nginx --no-pager

Add TLS and verify the public endpoint

Once the domain points to 203.0.113.10, issue a certificate. If DNS has not propagated yet, wait before running the certificate command. For a standard openSUSE Leap deployment with Nginx, use certbot if it is available in your enabled repositories; otherwise use your preferred ACME client.

After you have a certificate, make sure the site answers over HTTPS and redirects HTTP to HTTPS. The final web server layout should be Nginx on 80 and 443, with the model server still hidden on 127.0.0.1:8000.

On your local computer, test the HTTP path first:

curl -I http://server.example.com

Then test HTTPS:

curl -I https://server.example.com

Both commands should return HTTP headers from your server, not connection errors. If HTTPS fails with a certificate warning, inspect your ACME logs and Nginx server_name entry.

Smoke test the OpenAI-compatible API

Use a real API call to confirm the proxy, backend, and authentication all work together. The exact path depends on your model server implementation, but most OpenAI-compatible services accept a chat-completions style request.

On the VPS as the non-root sudo user, run a local smoke test against the backend first:

curl -s http://127.0.0.1:8000/v1/models

If the endpoint returns JSON, the backend is alive. Then test the public front end with the API key from the environment file:

curl -s https://server.example.com/v1/models -H 'Authorization: Bearer replace-with-a-long-random-secret'

You should receive a JSON response rather than a 401, 502, or timeout. If you get a 401, check the API key. If you get a 502, check the systemd service and the backend bind address.

Strengthen access after the first successful login

Only after the new account works should you tighten SSH. Before changing anything, keep the original root session open. That gives you a fallback if you misconfigure authentication.

On the VPS as root, edit the SSH daemon configuration carefully:

cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
cat >> /etc/ssh/sshd_config

Add or confirm these lines:

PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes

Save the file, then validate syntax before restarting SSH:

sshd -t
systemctl restart sshd

Open a fresh terminal and confirm you can still log in as deploy. Do not close the old session until the test succeeds.

Operational checks and rollback

Good production work includes recovery, not just deployment. If the model service fails, use these commands first:

systemctl status model-serving.service --no-pager
journalctl -u model-serving.service -b --no-pager
ss -tulpn | grep 8000

If Nginx returns 502, the usual cause is a backend crash or a bad bind address. Fix the backend, then re-run the smoke test. If you need to roll back the last service change, restore the unit from the backup copy you made before editing, then reload systemd and restart the service.

To check reboot persistence, reboot during a maintenance window and confirm that both services return automatically:

systemctl reboot

After the server comes back, reconnect and run:

systemctl is-active model-serving.service
systemctl is-active nginx

Both should report active. That tells you the deployment will survive a routine restart, which is one of the first things support teams care about during a cutover.

Troubleshooting the most likely failures

1. Port 8000 is not listening. Diagnose it with systemctl status model-serving.service. If the unit is failing, the logs will usually show a bad binary path or missing permissions. Correct the ExecStart line or file ownership, then restart the service.

2. Nginx returns 502 Bad Gateway. Check journalctl -u nginx -n 50 --no-pager and journalctl -u model-serving.service -n 50 --no-pager. A 502 usually means the backend is down or the proxy target is wrong. Confirm the backend is bound to 127.0.0.1:8000.

3. HTTPS fails after certificate setup. Run nginx -t and review the certificate paths in the server block. A typo in the file path or hostname is the common clue. Fix the config, then reload Nginx again.

4. SSH login is blocked after hardening. Use the original root session or Hostperl console access if you locked yourself out. The safest correction is to re-enable PasswordAuthentication temporarily, test the key path, and then apply the final SSH settings again with sshd -t before restarting.

If you are planning a private model endpoint for internal apps, customer portals, or agent tooling, Hostperl can help you match the workload to the right server class. Start with a Hostperl VPS for light and moderate inference, or move to dedicated server hosting when you need steadier compute, more RAM, and better isolation.

For deployments that need to stay private and support predictable uptime, the operational pattern in this guide gives you a practical baseline for launch and support handoff.

FAQ

Can I expose the model server directly to the internet?
Do not do that for production. Bind it to localhost and publish it through Nginx so you can add TLS, logs, and request controls.

Why use openSUSE Leap for this setup?
It gives you a stable enterprise-style base with zypper, firewalld, systemd, and AppArmor-compatible policy options. That makes it a practical fit for private services.

What if I need GPU acceleration later?
Keep the same reverse-proxy and systemd pattern. Only the backend runtime changes. The network and access controls should stay the same.

How do I know the deployment is healthy?
Check the systemd unit, confirm port 8000 is local only, and run an actual HTTP request through Nginx. Those three checks catch most launch problems.