2

So I have express.js set up behind nginx and when I go to website.com/users, I get a 404. But when I go to website.com, the page loads fine. This appears to be all other routes too, I can't get to website.com/public/css either. Here's my nginx config

upstream default {
    server 127.0.0.1:3000;
    keepalive 8;
}


server {
    listen 0.0.0.0:80;
    listen [::]:80 default_server ipv6only=on;

    root /var/www/;
    index index.html index.htm;

    # Make site accessible from http://localhost/
    server_name website.com default;
    access_log /var/log/nginx/default.log;

    return 301 https://website.com$request_uri;

    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;

        proxy_pass http://default/;
        proxy_redirect off;
    }

}

Any ideas?

John
  • 29
  • 3
  • 1
    Why do you have a redirection to https **and** a location block `/` ? – Xavier Lucas Jan 19 '15 at 18:44
  • I honestly don't know. This is the first time I've worked with nginx @XavierLucas – John Jan 19 '15 at 18:50
  • I do have SSL enabled though. @XavierLucas – John Jan 19 '15 at 18:52
  • Everything after `return 301 https://website.com$request_uri;` in your config is irrelevant. If you are redirecting all requests to https the config you are _actually_ using isn't in the question (unless you are using e.g. cloudflare's flexible ssl in which case it's an infinite loop). Since there's nothing in the question to understand what's happening: -1. – AD7six Jan 20 '15 at 13:20

0 Answers0