django:无法将应用连接到服务器(404错误)

时间:2020-04-29 15:12:29

标签: django nginx amazon-ec2 gunicorn

我正在使用AWS EC2,带有主管和Nginx的Gunicorn来部署django应用程序。我虔诚地遵循了教程,但是我的无能使我无法发现自己​​弄错了地方。连接到我的IP地址或域名时,出现错误消息,提示无法访问它们或尝试连接,然后提示“连接时间过长”

我认为它必须解决与主机相关的问题,因为在开发过程中,该应用程序就像一个魅力

settings.py


ALLOWED_HOSTS = ALLOWED_HOSTS = ['xxx.xxx.xxx.xxx', '127.0.0.1', 'mysite.com','www.mysite.com']

(它们也在/ etc / hosts /中设置。)

我的nginx配置:


server {
    listen 80;
    server_name    xxx.xxx.xxx.xxx mysite.com  www.mysite.com;

        location / {
            include proxy_params;
            proxy_pass http://unix:/home/ubuntu/exostocksaas/app.sock;

}
        location /static {
           autoindex on;
           alias /home/ubuntu/exostocksaas/inventory4/collected_static/;
}

}

这是我的枪械配置:

[program:gunicorn]
directory=/home/ubuntu/exostocksaas
command=/home/ubuntu/Exos/bin/gunicorn --workers 3 --bind unix:/home/ubuntu/exostocksaas/app.sock in$
autostart=true
autorestart=true
stderr_logfile=/var/log/gunicorn/gunicorn.err.log
stdout_logfile=/var/log/gunicorn/gunicorn.out.log
user=root
[group:guni]
programs:gunicorn

我还配置了我的EC2实例以也接受来自端口8000的流量。 当我运行runserver 0.0.0.0:8000时(我不建议运行它,而只是测试并启动端口8000上的IP地址,我会收到404错误。

在这一点上,我感到有些失落,并且不确定在哪里寻找问题。有人会对如何处理情况有所了解吗?

0 个答案:

没有答案