Flask is one of the simplest ways to write a web service in Python. There is no mandatory ORM, no imposed folder structure, and no dozens of dependencies "bundled in." You take what you need and build exactly the way you want. A REST API, a lightweight website, an internal corporate service, a prototype in a couple of hours - Flask handles all of these.
Setting up a production environment for Flask on your own takes time: Python, a virtual environment, Gunicorn, Nginx, proxy configuration, a systemd unit. A marketplace image deploys this standard environment in 1-2 minutes. Connect via SSH and it's already working.
What you will need
An account with a VPS provider that has an image marketplace
A VPS with 1-2 vCPUs and 1-2 GB of RAM
A domain, if you plan to issue an SSL certificate
Deploying a server from the marketplace
In the provider's marketplace, find the Flask image and click Deploy. Choose the configuration:
CPU: 1-2 vCPUs
RAM: 1-2 GB (enough for development and moderate load)
Disk: 20-40 GB SSD
Set a password or attach an SSH key, then click create. The server will be ready in 1-2 minutes.
Connecting via SSH and viewing the application data
Linux / macOS:
ssh root@SERVER_IPWindows - PowerShell or PuTTY:
ssh root@SERVER_IPAfter logging in, the terminal will display a welcome message with information about the deployed application: the Flask version, the Python version, and commands for managing the service.

SSH login - a welcome message with the Flask version and management commands
The main commands for working with Gunicorn are also shown here:
# Service status
systemctl status gunicorn
# Application logs
journalctl -u gunicorn
# Restart after code changes
systemctl restart gunicornThe application credentials are stored in the file /root/.password_credentials. View them with the command:
cat /root/.password_credentials
Output of cat /root/.password_credentials - APP_PATH and APP_USER
The file contains:
APP_PATH - the path to the Flask application directory
APP_USER - the user under which the application runs
By default, the application is located in /var/www/flask.
Opening the application in a browser
In your browser, go to the server's IP address:
http://SERVER_IP

Browser with the server address - Flask is running over HTTP
If an SSL certificate has not been set up yet, the site works over HTTP. The browser may show a warning - this is normal at the initial setup stage.
After opening the address, you will see the Flask start page. This is a template application that comes with the image - you can replace it with your own code right away.

The Flask start page in the browser - the template application is running
To host your own application, copy the files to the root directory /var/www/flask and restart Gunicorn:
# Upload files via scp
scp -r ./myapp/* root@SERVER_IP:/var/www/flask/
# Restart the service
systemctl restart gunicornIssuing an SSL certificate
Before setting up SSL, make sure the domain points to the server's IP address. To do this, create an A record in DNS:
A yourdomain.com → SERVER_IPOnce the DNS record has propagated, run Certbot:
certbot --nginxThe wizard will ask several questions:
An email address for certificate expiration notifications
Acceptance of the Let's Encrypt terms - enter
YThe domain or subdomain for the certificate - enter it without
http://andwww
For example: yourdomain.com or app.example.org

Certbot issues an SSL certificate - the interactive setup wizard
Certbot will find the Nginx configuration on its own, issue the certificate, and set up an automatic redirect from HTTP to HTTPS. Once it finishes, the site is available at https://yourdomain.com.
The certificate is valid for 90 days. Certbot renews it automatically via cron - you don't need to do anything manually.
Application structure
The image deploys a standard Flask project structure:
/var/www/flask/
├── app/
│ ├── __init__.py # Application factory
│ ├── routes.py # Routes
│ └── templates/ # Jinja2 templates
├── run.py # Entry point
└── requirements.txt # DependenciesNginx accepts incoming requests and proxies them to Gunicorn. Gunicorn runs Flask and operates as a systemd service. This combination is the standard for production environments in Python.
Managing the application
# Service status
systemctl status gunicorn
# Real-time logs
journalctl -u gunicorn -f
# Restart after code changes
systemctl restart gunicorn
# Stop / start
systemctl stop gunicorn
systemctl start gunicornWhen adding new dependencies, install them and restart:
cd /var/www/flask
pip install -r requirements.txt
systemctl restart gunicornWhat to set up next
Connect a database. Flask works with PostgreSQL via psycopg2 and SQLAlchemy, with MySQL via PyMySQL, and with Redis for caching. PostgreSQL is recommended for production workloads.
Set up monitoring. journalctl -u gunicorn covers basic needs, but for production it is useful to add alerts for service failures. Systemd can send an email when a unit stops abnormally.
Restrict access to the server. Block direct access to port 8000 (Gunicorn) in the firewall - it should be visible only from localhost, not from outside. Nginx listens on ports 80 and 443 and proxies traffic internally.
The marketplace image removes the routine of the initial deployment: Nginx, Gunicorn, and Flask are already configured and running. Replace the template with your own code, get an SSL certificate with a single command - and your application is ready to go.


