0

I've registered a domain with NameCheap and have set up an A redirect to my web server. Visiting the server directly (http://1.2.3.4) is fine, but going through the domain name returns 400 Bad Request from nginx.

What could I be doing wrong?

Here's the relevant part of the nginx config file.

server {
   listen 80;
   server_name localhost mydomain.org www.mydomain.org;
   location /tile/ {
        proxy_set_header Host $http_host;
        proxy_pass http://127.0.0.1:20008;
   }
   location /datasource/ {
        proxy_set_header Host $http_host;
        proxy_pass http://127.0.0.1:20008;
   }
   location /maps {
     alias   /usr/share/nginx/www/Project-OSRM-Web/WebContent/;
   }
   location /tilemill {
       rewrite     ^(.*)$ http://<myhardcoded IP address>:5002 permanent;
   }

   location / {
     alias   /usr/share/nginx/www/Project-OSRM-Web/WebContent/;
   }

}

No entries appear in /var/log/nginx/access.log or /var/log/nginx/error.log.

EDIT

More information: even with debugging switched on, nothing shows up in error.log when accessing mydomain.org - not a single line of output. However, accessing www.mydomain.org (which is set up identically at namecheap) works, and produces many pages of output.

Hmm. Ok, it's finally working. Shutting down nginx, waiting a minute, then starting it again did the trick. Previously I had been using sudo service nginx restart.

3
  • Have you checked that the name is resolving to the correct IP using nslookup?
    – Chris S
    Jul 16, 2013 at 3:57
  • Yes, it is. (4 more to go) Jul 16, 2013 at 4:02
  • This question appears to be off-topic because it is about Jul 19, 2013 at 2:46

1 Answer 1

1

I'm sorry for being unable to comment as I am a new user.

Have you tried all of the locations?

For example, since /maps is locally stored, perhaps it would work while /datasource and /tile might not because of the proxy pass.

Please post the results from testing each one of your URLs.

4
  • Thanks, good suggestion. I hadn't tried any of the other URLs until now since the main one failed. Now, actually www.mydomain.com/maps/ does work, so it's just / that doesn't work. (Which is strange, because the two have the same definition.) Jul 16, 2013 at 4:53
  • Ok, strangely the problem seems to have fixed itself. Maybe something to do with DNS records? Jul 16, 2013 at 4:55
  • Hmm, nope. It's weird. www.mydomain.com works (even if I leave servername as localhost). The IP address works. But mydomain.com doesn't. (Both www.mydomain.com and mydomani.com resolve correctly). Jul 16, 2013 at 5:14
  • What is your proxy pass referring to (port 20008)? Is it an application server or just another web server? Jul 18, 2013 at 19:14

Not the answer you're looking for? Browse other questions tagged .