Hey friends π
Today Iβm sharing my complete real-world deployment journey β from building a FastAPI project to making it live with:
- JWT Authentication (Login/Register)
- Landing Page + Dashboard UI
- FastAPI Backend
- Apache Reverse Proxy
- HTTPS (SSL with Certbot)
- VPS Hosting (Linux)
This is a step-by-step, copy-paste friendly guide β no confusion, just execution
Project Overview
My project includes:
- β Landing page
- β User Registration & Login
- β JWT Authentication
- β Dashboard (after login)
- β API-based backend (FastAPI)
- β Static + Templates (HTML/CSS/JS)
Step 1 β Setup Server
Install Python & pip:
sudo apt update
sudo apt install python3 python3-pip -y
Step 2 β Upload Project
Navigate to your project folder:
cd ~/htdocs/soical-media-automation/automation_platform
Step 3 β Install Dependencies
If you have requirements.txt:
pip3 install -r requirements.txt
If not:
pip3 install fastapi uvicorn python-dotenv
Step 4 β Run FastAPI App
nohup python3 -m uvicorn app.main:app --host 0.0.0.0 --port 8000 > uvicorn.log 2>&1 &
Check if running:
ps aux | grep uvicorn
Step 5 β Setup Apache (Reverse Proxy)
Install Apache:
sudo apt install apache2 -y
Enable required modules:
sudo a2enmod proxy
sudo a2enmod proxy_http
Step 6 β Apache Config (Single Clean Config)
Open config:
sudo nano /etc/apache2/sites-available/001-automate.conf
Paste:
<VirtualHost *:80>
ServerName automated.soicalmedia.selfmade.one
Redirect / https://automated.soicalmedia.selfmade.one/
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName automated.soicalmedia.selfmade.one
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:8000/
ProxyPassReverse / http://127.0.0.1:8000/
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/automated.soicalmedia.selfmade.one/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/automated.soicalmedia.selfmade.one/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
Step 7 β Clean Apache Sites
Disable default configs:
sudo a2dissite 000-default.conf
sudo a2dissite default-ssl.conf
sudo a2dissite 001-automate-le-ssl.conf
Enable your config:
sudo a2ensite 001-automate.conf
sudo service apache2 restart
Step 8 β Setup SSL (HTTPS)
Install Certbot:
sudo apt install certbot python3-certbot-apache -y
Run:
sudo certbot --apache -d automated.soicalmedia.selfmade.one
Choose:
- Email β your email
- Agree β Yes
- Redirect β Yes (HTTPS)
Step 9 β Create init.sh (Auto Run)
nano ~/init.sh
Paste:
#!/bin/bash
cd /home/mr.potter/htdocs/soical-media-automation/automation_platform
nohup python3 -m uvicorn app.main:app --host 0.0.0.0 --port 8000 > uvicorn.log 2>&1 &
Run:
chmod +x init.sh
./init.sh
Step 10 β JWT Authentication (Concept)
My app includes:
- User registration
- Login system
- JWT token generation
- Protected dashboard
Example flow:
from fastapi import Depends
from fastapi.security import OAuth2PasswordBearer
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="login")
@app.get("/dashboard")
def dashboard(token: str = Depends(oauth2_scheme)):
return {"message": "Welcome to dashboard"}
Frontend Structure
templates/
index.html
login.html
register.html
dashboard.html
static/
css/
js/
Common Issues I Faced (And Fixes)
Too Many Redirects
Cause: Multiple Apache configs
Fix: Use single config only
requirements.txt not found
Wrong folder
Fix: cd into correct directory
Permission denied
Fix:
sudo chown mr.potter:mr.potter filename
systemctl not working
Use:
sudo service apache2 restart
Final Result
β Live SaaS App
β Secure HTTPS
β Login/Register system
β Dashboard
β API backend
Final Thoughts
This wasnβt just deployment β it was:
- DevOps basics
- Backend engineering
- Real production setup
If youβre building something similar β donβt stop at localhost.
Deploy it. Break it. Fix it. Learn it
Letβs Connect
If youβre building something cool or stuck in deployment, feel free to reach out
Happy coding
Top comments (0)