sospedra
sospedra

Reputation: 14734

Proxy_pass nginx not found

So, I was developing my server following the micro services arch in node. Therefore, I'm using nginx to redirect correctly the routes with each service. And was going pretty well since I added ghost on a subdirectory.

Now, Ghost is working perfectly but all the others routes are broken. The nginx answer is not found.

My nginx server congiguration:

server {
  listen 0.0.0.0:80;

  location / {
    root /var/www/html;
  }

  location ^~ /blog {
    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://127.0.0.1:2368;
    proxy_redirect off;
  }

  location /tool/ {
    proxy_pass http://127.0.0.1:8100/;
  }
}

Also I test the micro services with, ie:

telnet localhost 8100

Result it's ok.

I'm not even close to know what's happening, any help would be great. Thanks in advance.

EDIT: Also I notice that if I start a micro service on root, ie, the next routes try to follow the service instead of the nginx routing.

Upvotes: 0

Views: 791

Answers (2)

sospedra
sospedra

Reputation: 14734

As @Anatoly said trailing slashes make differences!

Upvotes: 1

lauea
lauea

Reputation: 1

You can try to change Nginx config like as below:

listen 80;

server_name  <your pc name or localhost or 127.0.0.1>

Upvotes: 0

Related Questions