Problem: all urls go to my landing page, including a basic '/about' and '/contact'
Example: Url www.mydomain.com works perfectly (loads css, etc), but www.mydomain.com/about goes to www.mydomain.com even though it says www.mydomain.com/about in address bar.
Question: How do I configure nginx to simply pass everything through to django?
I'm deploying a website I've written locally using django to an EC2 instance. I am able to access my default landing page, but I can't access any other page. I have a basic site with /about, /contact mappings, but when I go to them I simply am redirected to my landing page. I'm pretty sure that this has something to do with my nginx config, but after looking through basic nginx tutorials I don't think I'm grasping what I'm missing.
Here is my conf file for nginx...
server {
listen 80;
server_name mydomain.com;
access_log /var/log/nginx/sample_project.access.log;
error_log /var/log/nginx/sample_project.error.log;
# https://docs.djangoproject.com/en/dev/howto/static-files/#serving-static-files-in-production
location /static/ { # STATIC_URL
alias /home/ubuntu/path/to/static/; # STATIC_ROOT
expires 30d;
}
location /media/ { # MEDIA_URL
alias /home/ubuntu/path/to/static/; # MEDIA_ROOT
expires 30d;
}
# I have also tried 'location ~* ^(.*?)$' and it had the same effect
location / {
include fastcgi_params;
fastcgi_pass 127.0.0.1:8080;
}
}
As I read through nginx tutorials/etc, I can appreciate that it can do a lot, but I would prefer to handle all incoming urls through django.