Sitemap

Ollama + Nginx Reverse Proxy Setup Guide

2 min readOct 17, 2025

πŸ“‹ Prerequisites

Before you begin, ensure you have:

  • A server (e.g., Ubuntu) with root access
  • Nginx installed
  • Certbot (for SSL certificates via Let’s Encrypt)
  • Ollama installed and running TinyLlama locally

βš™οΈ Step 1: Install and Run Ollama + TinyLlama

# Install Ollama
curl -fsSL https://ollama.com/install.sh | sh

# Start Ollama service
sudo systemctl enable ollama
sudo systemctl start ollama

# Pull the TinyLlama model
ollama pull tinyllama

# Run it locally (default listens on port 11434)
ollama run tinyllama

🌐 Step 2: Configure Nginx Reverse Proxy

Create or edit the Nginx config file:

sudo nano /etc/nginx/sites-available/app.wakeupcoders.com

Paste this configuration:

server {
server_name app.wakeupcoders.com www.app.wakeupcoders.com;

location / {
proxy_pass http://127.0.0.1:11434;
#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_set_header Origin β€˜β€™;
proxy_set_header Referer β€˜β€™;
}

listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/app.wakeupcoders.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/app.wakeupcoders.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

server {
if ($host = app.wakeupcoders.com) {
return 301 https://$host$request_uri;
} # managed by Certbot

listen 80;
server_name app.wakeupcoders.com www.app.wakeupcoders.com;
return 404; # managed by Certbot
}

Save and exit (CTRL+O, ENTER, CTRL+X).

Then enable and test:

sudo ln -s /etc/nginx/sites-available/app.wakeupcoders.com /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx

πŸ”’ Step 3: Set Up SSL with Certbot

If you haven’t already:

sudo apt install certbot python3-certbot-nginx -y
sudo certbot β€” nginx -d app.wakeupcoders.com -d www.app.wakeupcoders.com

πŸš€ Step 4: Test the Setup

Visit: https://app.wakeupcoders.com

To test with curl:

curl -X POST https://app.wakeupcoders.com/api/generate \
-d '{"model":"tinyllama","prompt":"Hello, world!"}' \
-H "Content-Type: application/json"

Expected response (example):

{"response": "Hello! How can I help you today?"}

--

--

Wakeupcoders - Think Beyond Everything
Wakeupcoders - Think Beyond Everything

Written by Wakeupcoders - Think Beyond Everything

We make your business smarter and broader through the power of the internet. Researcher | Web developer | Internet of things | AI | www.wakeupcoders.com

Responses (1)