[Python] How do I configure nginx to serve static files from an AWS S3 bucket?

Discussão em 'Python' iniciado por Stack, Novembro 30, 2024.

  1. Stack

    Stack Membro Participativo

    I'm currently deploying a simple flask web application with nginx as my reverse proxy sitting between my WSGI and users. However, I don't want to store static files(specifically images) on my VPS because storage space will start to get expensive as the number of users go up. I've been able to use the AWS S3 boto3 package to upload images to the bucket but I'm not entirely sure how to configure the nginx web server(shown below) to serve the images from my S3 bucket.

    server {
    listen 80;
    server_name $IP_ADDR;

    location /static {
    alias /home/a_mankavil11/flaskBlog/flaskBlog/static;
    }

    location / {
    proxy_pass http://localhost:8000;
    include /etc/nginx/proxy_params;
    proxy_redirect off;
    }


    }


    Bear in mind my experience with server configuration is quite rudimentary.

    Continue reading...

Compartilhe esta Página