Home:ALL Converter>Nginx and gunicron serve django app and media files on the same port

Nginx and gunicron serve django app and media files on the same port

Ask Time:2020-04-27T06:58:43         Author:Nadhem Maaloul

Json Formatter

I have a remote server used to serve a django application. when I choose DEBUG=False I had to add a nginx server to serve media files from /media folder. when I try to restart nginx after running gunicron I get an error saying that port 8000 is used. how do I manage to serve the app and the media files on the same port? This is the actual content of mysite_nginx.conf file

server {
listen 8000;
listen [::]:80;

    ... 

location / {
        proxy_pass "http://localhost:8000";
    }
}

Author:Nadhem Maaloul,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/61449227/nginx-and-gunicron-serve-django-app-and-media-files-on-the-same-port
yy