NGINX - react.app - problems with 404 when I call domain/auth etc.

mbcodecamp1

New Member
Hello dear nginx experts,

I have set up a domain "schal-xgi.ga" on my server!

When I call "https://schal-xgi.ga" everything runs perfectly!
However, when I call "https://schal-xgi.ga/auth" I get a 404 error!

My configuration in "sites-available" is like this:

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

root /var/www/schal-xgi.ga/html;
index index.html index.htm index.nginx-debian.html;

server_name schal-xgi.ga www.schal-xgi.ga;

location / {
try_files $uri $uri/ =404;
}

listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/schal-xgi.ga/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/schal-xgi.ga/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

What do I need to put there so that the following calls don't return a 404 error:

"https://schal-xgi.ga/auth"
"https://schal-xgi.ga/user"
"https://schal-xgi.ga/user/1"
etc.

Thanks in advance for your help.
Best regards
Markus
 

marce

Well-Known Member
... you should put content into your webroot which can process the requests or configure your server to send the requests to the intended backend.
 

mbcodecamp1

New Member
The cause was in the nginx configuration for the domain:

location / {
# try_files $uri $uri/ =404;
try_files $uri $uri/ /index.html;
}

"try_files $uri $uri/ =404;" was wrong!
 
Top