0

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 127.0.0.1 or 127.0.0.1:80.

I have this configuration file:

upstream django {
    # connect to this socket
    server 127.0.0.1:8001;
    }

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

    server_name 127.0.0.1;

    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 127.0.0.1:80 but i cannot connect to 127.0.0.1:8000.

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

Anyone knows what is the problem?

Denis V
  • 111
  • 4

1 Answers1

1

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.

Denis V
  • 111
  • 4