Skip to content

nginx

Deploying any Web application with Nginx: Example of Flask

Introduction

You have created your flask application. How nice ! Now, you want to go a step further and deploy it. For most hosting services, you have nice interfaces to deploy your python applications with support for flask. But sometimes, you only have access via ssh to the server.

This is a very straigthforward tutorial on how to do it.

This tutorial also applies to any web server you can run on local but want to deploy

Step 1: Install Nginx and Flask

Make sure you have Nginx and Flask installed on your server. If not, install them using the appropriate package manager for your operating system.

Step 2: Configure Nginx

Create a new Nginx configuration file for your Flask app in the /etc/nginx/sites-available/ directory. For example, you could name it myapp.conf. Edit the file and add the following configuration: