Deploying a file server sounds simple.
Making it production-ready is where most developers struggle.
You don’t just need to run the app.
You need to:
- keep it running
- secure it
- handle traffic properly
In this guide, you’ll deploy a real file server using Spring Boot, Nginx, and a VPS.
Start with a ready backend
Instead of building everything from scratch, you can start with a ready file server backend.
https://buildbasekit.com/boilerplates/filora-fs-lite/
It already includes:
- file upload APIs
- clean project structure
- production-ready setup
- easy deployment flow (used in this guide)
You can follow this tutorial directly using this boilerplate.
What you’ll build
By the end, you’ll have a file server that:
- accepts file uploads
- runs continuously with systemd
- serves traffic via Nginx
- uses HTTPS (SSL)
- is protected with a firewall
Prerequisites
- VPS (Ubuntu recommended)
- Java installed
- your Spring Boot jar ready
- domain (optional but needed for HTTPS)
1. Prepare your app
Do not hardcode configs.
Use environment variables instead.
Example:
spring.application.name=filorafs
server.port=8080
storage.local.path=/opt/filora/uploads
2. Connect to your VPS
ssh -i your-key.key ubuntu@your-ip
Install dependencies:
sudo apt update && sudo apt upgrade -y
sudo apt install openjdk-21-jdk nginx ufw -y
3. Setup app directory
sudo mkdir -p /opt/filora
sudo chown -R $USER:$USER /opt/filora
Upload your jar:
scp target/app.jar ubuntu@your-ip:/opt/filora/
4. Add environment variables
Create .env file:
DB_PASSWORD=your_password
SERVER_PORT=8080
STORAGE_PATH=/opt/filora/uploads
5. Run app manually
cd /opt/filora
source .env
java -jar app.jar
If it works → move forward.
6. Setup systemd (important)
Create service:
sudo nano /etc/systemd/system/app.service
Paste:
[Unit]
Description=File Server
After=network.target
[Service]
User=ubuntu
WorkingDirectory=/opt/filora
EnvironmentFile=/opt/filora/.env
ExecStart=/usr/bin/java -jar /opt/filora/app.jar
Restart=always
[Install]
WantedBy=multi-user.target
Start service:
sudo systemctl daemon-reload
sudo systemctl enable app
sudo systemctl start app
7. Setup Nginx
sudo nano /etc/nginx/sites-available/app
server {
listen 80;
server_name yourdomain.com;
client_max_body_size 100M;
location / {
proxy_pass http://localhost:8080;
}
}
Enable:
sudo ln -s /etc/nginx/sites-available/app /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
8. Add HTTPS
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d yourdomain.com
9. Secure server
sudo ufw allow OpenSSH
sudo ufw allow 'Nginx Full'
sudo ufw enable
Do NOT expose port 8080 publicly.
10. Test everything
- upload file
- check logs
- verify HTTPS
Logs:
journalctl -u app -f
Common mistakes
- exposing backend port directly
- wrong file permissions
- hardcoded configs
- skipping HTTPS
Final thoughts
A file server is easy to build.
A production-ready setup is what actually matters.
Once you understand this flow:
build → deploy → proxy → secure
you can deploy almost any backend.
Skip the setup
If you don’t want to do all this manually:
https://buildbasekit.com/boilerplates/filora-fs-lite/
- ready backend
- file upload APIs
- production structure
- open source
Build faster. Focus on features.