cannot connect to server after linking to domain name

I am deploying my django app with AWS EC2, Gunicorn with supervisor and Nginx. I have religiously followed tutorials but my incompetence prevent me to spot where I am mistaken. When connecting to my IP address or my domain name I get an error saying that they cannot be reached or it tryes to connect and then says “took too long to connect”

I am thinking it has to issues related with hosts because in development the app works like a charm

settings.py

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

they also are set up in /etc/hosts/.

My nginx configuration:

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/;
}

}

and this is my gunicorn configuration:

[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

And I have also configurate my EC2 instance to also accept trafic from port 8000.
when I run runserver 0.0.0.0:8000 (i know its not recommanded but just to test and launch the IP address on port 8000, I get 404 error.

At this point I am feeling a little bit lost and not sure where to look for the issue. Would someone has a clue about how to handle the situation?

Don’t speak like that about yourself! You’re learning, as we all are! No one was born programming.

I’ve not used this way of passing to a socket before, but it looks like from the nginx docs that you’d want a final :/ to indicate the base URL?

proxy_pass http://unix:/home/ubuntu/exostocksaas/app.sock:/;

One thing to do in this situation is figure out which thinig is giving the 404.

Where are you passing the app module to gunicorn? If you run this command alone, does iti work?

Thanks Adam! So I just noticed that when I pasted my code it got cut off: here is the line where I pass the app in gunicorn:

command=/home/ubuntu/Exos/bin/gunicorn --workers 3 --bind unix:/home/ubuntu/exostocksaas/app.sock inventory4.wsgi:application 

Thank you for spotting the : in the nginx file. I will fix it! And as far figuring out what’s up with the 404 error where would be a good place to begin, like to check what could a reason for the issue?

Well first I’d check the logs of all the programs, and trying increasing their logging level to get more information. And check what’s returning the 404 - is it really runserver, or is gunicorn somehow still running? If it’s runserver, you can try setting DEBUG on - but only temporarily since you’re exposed to the internet !

Thank you, I figured it, I set up ssl certificate and (almost) everything was fine!