In this tutorial, I will guide you through setting up a FastAPI server on a remote machine, configuring Nginx as a reverse proxy, and enabling HTTPS using Certbot. Step 1: Setting Up a Non-sudo User on the Remote Machine Create a Non-sudo User: sudo adduser karthik Switch to the New User: su karthik Create SSH Directory and Authorized Keys: cd ~/ mkdir .ssh touch .ssh/authorized_keys Append your local machine's SSH public key to ~/.ssh/authorized_keys on the remote machine. Step 2: Installing Nginx Install Nginx: sudo apt- get update sudo apt- get install nginx Verify Nginx Installation: Open a web browser and enter your remote machine's IP address. You should see the Nginx welcome page. Step 3: Configuring Nginx as a Reverse Proxy Edit Nginx Configuration: sudo nano /etc/ nginx /sites-available/ fastapi Add the following configuration (use a simple webserver for testing this): server { listen 80 ; server_name your_domain; loc
Sharanagatam
I write about tech, Indic Ideologies, and other stuff.