1

I have created the Django web app and deployed to ec2 instance using Nginx and supervisor it is working fine.

I bout new domain and I configured its AWS route 53. I am able to see my domain name is mapping for aws instance.

But when I try to access the Django web app it's giving 404.

I have updated the server_name parm in my Nginx config

server {
    listen 80;
    server_name equitynotify.com;

  location {
        include proxy_params;
        proxy_pass http://unix:/**/***/***/source/prod/boo-gateway/boogateway/app.sock;
    }
    location /static/ {
        autoindex on;
        alias /******/path;
}

Even I added the domain name is allowed hots of Django settings file still it's not working.

Any idea whats I am missing

Update: When I try to create one more sample app and run it port 9000 I am able to access it http://www.equitynotify.com:9000/upcomingresults/ and even if I create it the simple HTTP server 8000 port it is working, only the default 80 port is not working what may be reason

me-wright
  • 57
  • 9

1 Answers1

2

Django's official documentation recommends adding domain names to your ALLOWED_HOSTS as www.your_domain.com if you want to specify full qualified names or .your_domain.com in order to cover both your_domain.com and www.your_domain.com. So you need to add .equitynotify.com to your ALLOWED_HOSTS.

EDIT: You also need to add your django port to the proxy_pass. If you didnt specify any custom port number, django has 8000 as its default port. Here is an example:

server {
  listen 80;

  server_name equitynotify.com;

  location / {
      proxy_pass http://localhost:8000/;
  }
}
cagrias
  • 1,847
  • 3
  • 13
  • 24
  • It's not worked, but when I try to create one more sample app and run it port 9000 I am able to access it http://www.equitynotify.com:9000/upcomingresults/ and even if I create it the simple HTTP server 8000 port it is working, only the default 80 port is not working what may be reason – me-wright Aug 04 '19 at 09:00
  • Maybe you need to add the port in the proxy_pass variable? – cagrias Aug 04 '19 at 09:01
  • See my updated answer. You can find a more detailed example at https://www.linode.com/docs/web-servers/nginx/use-nginx-reverse-proxy/ – cagrias Aug 04 '19 at 09:09