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.:

  • How to copy files in maven build that can be used at run time on Docker container?
  • Host network access from linked container
  • sudo command not found after trying to use docker without sudo
  • Run go program without Go environment
  • How to solve “shell request failed on channel 0” on RHEL container?
  • How to import .bacpac into docker Sqlserver?
  • 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.

  • bundler: command not found: rails with docker-compose on a sample project
  • docker build - exactly 1 argument
  • Docker for windows container is not starting with -m 4g but works fine with -m 3g
  • Connect to database in docker container on remote host with pgadmin3
  • Mesos, Marathon, the cloud and 10 data centers - How to talk to each other?
  • Run VirtualBox VM as headless in Docker container
  • 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.