Nginx not serving django image

空扰寡人 提交于 2019-12-13 03:37:40

问题


I'm trying to follow the tutorial at http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html. I've gotten down to http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html#basic-nginx-test. Following the directions I have:

(env1)ubuntu@ip-172-31-28-196:~$ sudo /etc/init.d/nginx start
(env1)ubuntu@ip-172-31-28-196:~$ ls
host_type.py  requirements.txt  test.py  tproxy

However when I go to my ubuntu ec2 instance at:

http://52.10.**.***:8000/media/media.jpg

The request times out. What am I doing wrong?

EDIT: - the config file

# mysite_nginx.conf    

# the upstream component nginx needs to connect to
upstream django {
    # server unix:///path/to/your/mysite/mysite.sock; # for a file socket
    server 127.0.0.1:8001; # for a web port socket (we'll use this first)
}    

# configuration of the server
server {
    # the port your site will be served on
    listen      8000;
    # the domain name it will serve for
    server_name 52.**.***.**; # substitute your machine's IP address or FQDN
    charset     utf-8;    

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

    # Django media
    location /media  {
        alias ./media;  # your Django project's media files - amend as required
    }    

    location /static {
        alias ./static; # your Django project's static files - amend as required
    }    

    # Finally, send all non-media requests to the Django server.
    location / {
        uwsgi_pass  django;
        include     ./uwsgi_params; # the uwsgi_params file you installed
    }
}

nginx error log:

2015/03/03 18:06:06 [emerg] 1989#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2015/03/03 18:06:06 [emerg] 1989#0: bind() to [::]:80 failed (98: Address already in use)
2015/03/03 18:06:06 [emerg] 1989#0: still could not bind()

来源:https://stackoverflow.com/questions/28842070/nginx-not-serving-django-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!