I am following this guide in order to set up one Django app with nginx.

I have installed Nginx and I can access it on or

I have this configuration file:

upstream django {
    # connect to this socket

server {
    # the port your site will be served on
    listen 8000 default_server;
    listen [::]:8000 default_server;


    charset     utf-8;

    #Max upload size
    client_max_body_size 75M;   # adjust to taste

    # Django media
    location /media  {
        alias /home/dwv/Documents/FMQDjango/BetApp/media;

    location /static {
        alias /home/dwv/Documents/FMQDjango/BetApp/static;

    location / {
        uwsgi_pass  django;
        include     /etc/nginx/uwsgi_params;

I have symlinked this file to /etc/nginx/sites-enabled/

I still can access the "welcome message" on but i cannot connect to

I have a file called porto.jpg on my media folder, then I try to access it on but i still cannot connect to server.

Anyone knows what is the problem?


Problem solved!

I don't even know why I was getting that error.

What I was doing:

  • Create an empty file on my Project root folder;
  • Edit the file on Sublime with the code I pasted on my question;
  • ERROR. Do not work.

What I did to solve it:

  • sudo nano /etc/nginx/sites-available/myconf;

  • The previous command opens an editor;

  • Write the same code on the terminal Editor;

  • It worked!

The code is the same, I don't know why, on first approach it do not work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.