Note that there are some explanatory texts on larger screens.

plurals
  1. POAll urls going to / when trying to run django/nginx on EC2
    primarykey
    data
    text
    <p><strong>Problem</strong>: all urls go to my landing page, including a basic '/about' and '/contact'</p> <p><strong>Example</strong>: 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.</p> <p><strong>Question</strong>: How do I configure nginx to simply pass everything through to django?</p> <p>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.</p> <p>Here is my conf file for nginx...</p> <pre><code>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; } } </code></pre> <p>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.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload