0

I have a smalle project that I created an my Raspberry Pi. On the Pi I have a added Nginx and NodeJs in order to create a small Express server.

My Express server has a sub path called /api/ip where I can get some information about my IP-address. I have no other subdomains atm.

The problem is that I can route to the path when I go arround nginx: '192.168.1.4:5000/api/ip'. But I cannot get a 404 when I browse to: '192.168.1.4/api/ip' and the default path '192.168.1.4' is working in the browser.

So I find this very strange why nginx is able to redirect to the '/' but not to any subdomains.

I have added a proxy_pass to the /etc/nginx/sites-available/default file:

server {
        listen 80 default_server;
        listen [::]:80 default_server;

        root /var/www/html;

        # Add index.php to the list if you are using PHP
        index index.html index.htm index.nginx-debian.html;

        server_name _;

        location / {
                proxy_pass http://localhost:5000;
                try_files $uri $uri/ =404;
        }
}
Stephen
  • 101
  • 1

0 Answers0