Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Sichere ProgrammierungRefreshed repository pull requests page generally available(22.09.2026 um 03:25 Uhr)
Sichere ProgrammierungThe Joy of Learning the Basics Again(22.09.2026 um 03:28 Uhr)
Sichere ProgrammierungZero-Code OpenTelemetry Tracing for Dagster(22.09.2026 um 03:39 Uhr)
Linux Tipps & Hardening`prime-all`(22.09.2026 um 02:28 Uhr)
IT Security Toolsopensoho v0.15.2(22.09.2026 um 03:33 Uhr)
IT Security NachrichtenUS Proposes AI Incident Alert System in Talks With China, Bessent Says(22.09.2026 um 04:01 Uhr)
Sichere ProgrammierungRefreshed repository pull requests page generally available(22.09.2026 um 03:25 Uhr)
Sichere ProgrammierungThe Joy of Learning the Basics Again(22.09.2026 um 03:28 Uhr)
Sichere ProgrammierungZero-Code OpenTelemetry Tracing for Dagster(22.09.2026 um 03:39 Uhr)
Linux Tipps & Hardening`prime-all`(22.09.2026 um 02:28 Uhr)
IT Security Toolsopensoho v0.15.2(22.09.2026 um 03:33 Uhr)
IT Security NachrichtenUS Proposes AI Incident Alert System in Talks With China, Bessent Says(22.09.2026 um 04:01 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Reverse Proxy | Host your app with Nginx and Certbot

Recently, I created a FastAPI app as the backend for my multiple frontend services. If any fronend visits https://some-api.somecompany.com/my-api, then backend would respond. TL;DR: Installations Create a VM in any…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

Recently, I created a FastAPI app as the backend for my multiple frontend services.



If any fronend visits https://some-api.somecompany.com/my-api, then backend would respond.






TL;DR:






Installations




  1. Create a VM in any Cloud platform. (I use Ubuntu 24.04 LTS)

  2. Create a DNS record points to VM's IP. (let's say some-api.somecompany.com)


  3. Install Nginx using Ubuntu's apt package manager.


  4. Create and edit a configuration file sudo vim /etc/nginx/conf.d/some-api.conf with the following content:


    server {
    listen 80;
    server_name some-api.somecompany.com

    location /my-api/ {
    proxy_pass http://0.0.0.0:8000
    }
    }




  5. Install CertBot using snap. snap is included in Ubuntu 24.04 LTS


    # Install Certbot
    sudo snap install --classic certbot

    # Prepare the Certbot command
    sudo ln -s /snap/bin/certbot /usr/bin/certbot




  6. Run sudo certbot --nginx to start fetching a cert to enable HTTPS.

    After providing an email "for urgent renewal and security notices", agreeing Terms of Service, agreeing sharing your email address, Certbot scan all files under /etc/nginx/conf.d (only one in this case) and list domain names:


    Which names would you like to activate HTTPS for?
    We recommend selecting either all domains, or all domains in a VirtualHost/server block.
    ---------------------
    1: some-api.somecompany.com
    ---------------------



    Select 1, hit Enter.








Testing





  1. Spin up the FastAPI app cd /THE/ABSOLUTE/PATH/TO/YOUR/APP && source .venv/bin/activate && uvicorn main:app --host 0.0.0.0 --port 8080





    1. cd /THE/ABSOLUTE/PATH/TO/YOUR/APP: Changes the current directory to the absolute path specified. This is where your application code is located.


    2. &&: This is a logical operator in the shell that allows you to run multiple commands in sequence. The command following && will only run if the command before it was successful.


    3. source .venv/bin/activate: Sources (executes) the activate script located in the .venv/bin directory. This script is typically used to activate a virtual environment in Python. When you activate a virtual environment, it sets up the environment variables and paths specific to that virtual environment.


    4. uvicorn main:app --host 0.0.0.0 --port 8080: This command starts the Uvicorn ASGI server to run your application. main:app refers to the Python file main.py and the app object within it that Uvicorn should run. The --host 0.0.0.0 flag specifies that the server should listen on all network interfaces, and --port 8080 specifies the port number (8080) on which the server should listen for incoming connections.






  2. Visit https://some-api.somecompany.com/my-api see if it works








Deploying




  1. Make sure your VM's IP is a "static" one, which means it will never change after VM stop (deallocated) and start.



  2. Let Ubuntu run FastAPI app after any unexpected restart:



    echo "@reboot root bash -c 'cd /THE/ABSOLUTE/PATH/TO/YOUR/APP && source .venv/bin/activate && uvicorn main:app --host 0.0.0.0 --port 8080 > /tmp/YOU_NAME_IT.log 2>&1'" | sudo tee -a /etc/crontab



    this command sets up a cron job that will run the specified command at system reboot. The command changes to the app directory, activates the virtual environment, starts the Uvicorn server, and logs the output to a specified file.



    ***Why bash -c?

    In the result of my practice, without bash -c the FastAPI app won't run successfully after reboot.



  3. Restart your VM to see if it still works.


Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Reverse Proxy | Host your app with Nginx and Certbot

Thematisch verwandte Begriffe: Reverse, Proxy, Host, your · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-61647 | NotebookLM MCP is an MCP server and HTTP service for interacting with Go…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick