404 on Nginx running on docker (uwsgi)

I have been battling with this and can’t get my head around it.

I have a simple Dockerfile which works and I use supervisord as CMD to start nginx and uwsgi. And it does the job but I get back 404. So what I do is to instead start the docker with /bin/bash and manually start things and debug, e.g.:

  • Docker auto spawning required connected container types on demand
  • Is it possible to directly call docker run from AWS lambda
  • Send logs to ELK container from Docker containers (without Filebeat)
  • Jenkins is not waiting for Docker command to finish
  • Can't reach ActiveMQ Port on Docker from my host
  • Start docker container from another application in another docker container
  • sudo docker run -t -i -p 8095:80  myimage /bin/bash

    So this is my nginx conf (in sites-available and then a link in sites-enabled):

    server {
        listen 80;
        location / {
            include uwsgi_params;
            uwsgi_pass unix:/WikiRockWord2Vec/WikiRockWord2Vec.sock;

    and this is my uwsgi ini:

    module = wsgi
    master = true
    processes = 5
    socket = /WikiRockWord2Vec/WikiRockWord2Vec.sock
    chmod-socket = 777
    vacuum = true
    uid = www-data
    die-on-term = true

    Socket does get created and I have changed permission to 777 to make sure all nginx has access to. But it seems nginx does not send to upstream anyway.

    Browsing to localhost:8095 brings the nginx homepage find but any other route returns 404. Nginx error log is empty.

    I have confirmed that nginx reads the .conf (by adding spelling mistake and see the error in the nginx log) but changing socket location has no impact as if it does not even care about that section. In similar cases on my ubuntu box when the sock file does not exist or there is a permission issue, I get 502 and some hint in the logs. But here I get nothing, as if UWSGI NOT CONFIGURED AGAINST NGINX.

    I am lost, can you please help? Am I missing module configuration in nginx (similar to apache)? I am new to nginx.

  • docker --volumes-from not mounting any files
  • Add file to docker container to be used during startup
  • Docker container shows running even after exit command
  • Force a problematic docker container to restart itself?
  • Localhost connection refused in Docker development environment
  • Separate clock process from sidekiq workers on Docker
  • 2 Solutions collect form web for “404 on Nginx running on docker (uwsgi)”

    404 is probably because your nginx conf file’s server block incorrect, i think is because your server_name part.

    so here is my modified version, you can check if it working

    server {
        listen 80 default_server;
        location / {
            uwsgi_pass unix:///WikiRockWord2Vec/WikiRockWord2Vec.sock;
            include uwsgi_params;

    Configuring Nginx, uWSGI, Supervisord, etc, (and just for a Flask application) could be difficult, so I made a public (and open source) Docker image with all the bells and whistles that you can use to build a Python Flask web application.

    It has uWSGI for running the application, Nginx to serve HTTP and Supervisord to control them, so you don’t have to learn how to install and configure all those to build your Python Flask web app.

    It seems like uWSGI with Nginx is one of the more robust (and with great performance) ways to deploy a Python web app. Here are the benchmarks: http://nichol.as/benchmark-of-python-web-servers.

    There are even some template projects you can use to bootstrap your own. And also, you don’t have to clone the full project or something, you can just use it as a base image.

    Docker Hub: https://hub.docker.com/r/tiangolo/uwsgi-nginx-flask/

    GitHub: https://github.com/tiangolo/uwsgi-nginx-flask-docker

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.