score:0

this error appears as nginx cannot match a file on the provided path home#/transactions.

since you haven't provided your nginx.conf file. my assumption would be that you are missing a fallback in the try_files directive or the entire directive.

as you mentioned you are using create-react-app, that means your build output is a single index.html file and a bunch of static assets.

the following rule should match the static asset if it finds it and fallback to index.html if it doesn't exist, from where your frontend router will take care of the rest and show you the correct page.

try_files $uri $uri/ /index.html;

update (op added nginx.conf):

the provided nginx.conf file's location block is not valid. location should be specified under a server block.

i noticed that in your nginx.conf file you are importing multiple other confs and it would've been useful to also add those since they might have an effect on the outcome. this import in particular caught my attention:

include /etc/nginx/conf.d/*.conf;

this path can match default.conf if present, but i'm just guessing at this point. if it did and default.conf was unaltered, that would explain the behavior you are describing since default.conf looks like this:

server {
   listen       80;
   server_name  localhost;

   #charset koi8-r;
   #access_log  /var/log/nginx/log/host.access.log  main;

   location / {
       root   /usr/share/nginx/html;
       index  index.html index.htm;
   }

   #error_page  404              /404.html;

   # redirect server error pages to the static page /50x.html
   #
   error_page   500 502 503 504  /50x.html;
   location = /50x.html {
       root   /usr/share/nginx/html;
   }

   # proxy the php scripts to apache listening on 127.0.0.1:80
   #
   #location ~ \.php$ {
   #    proxy_pass   http://127.0.0.1;
   #}

   # pass the php scripts to fastcgi server listening on 127.0.0.1:9000
   #
   #location ~ \.php$ {
   #    root           html;
   #    fastcgi_pass   127.0.0.1:9000;
   #    fastcgi_index  index.php;
   #    fastcgi_param  script_filename  /scripts$fastcgi_script_name;
   #    include        fastcgi_params;
   #}

   # deny access to .htaccess files, if apache's document root
   # concurs with nginx's one
   #
   #location ~ /\.ht {
   #    deny  all;
   #}
}

there are a few possible solutions (assuming default.conf causes the issue):

  1. add try_files to the default config like so:
# default.conf

server {
   ...
   location / {
       root   /usr/share/nginx/html;
       try_files $uri $uri/ /index.html;
       index  index.html index.htm;
   }
}

if default.conf is shared with other configs, this is breaking for them

  1. (preferred) omit the import of default.conf and add a custom server to nginx.conf. a server as simple as this will do the trick:
http {
    ...
    server {
        listen       80; # port
        server_name  _; # name
        root   /usr/share/nginx/html; # build dir
        try_files $uri $uri/ /index.html;
        index  index.html;
    }
}

Related Query

More Query from same tag