I have two EC2 instances.
I am using one to deploy Django using Gunicorn.
The other one is being used to serve the requests using Nginx which points to Gunicorn server.
Now normally I would run collectstatic and the Nginx configuration for static files would be like:
server {
listen 80;
server_name server_domain_or_IP;
location /static/ {
# my static files directory
root /home/user/myproject;
}
# other locations here
}
This configuration works well when both Nginx and Gunicorn are deployed on same server.
But I don not know how to route my static files requests in this case where Gunicorn server is different.
Either there should be some way to collect my static files on the Nginx server itself, or route my requests to Gunicorn server.
I can use S3 to host my static files, but that is not an option as of now.