When I go to mywebsite.com I see my website. However when I go to mywebsite.com/page then I get a 404.
I am using nginx to deliver the files and from what I read I have configured it to always go to index, but it doesnt seem to work.
Here is my nginx config:
server {
listen 80 default_server;
server_name mywebsite.com;
root /var/www/mywebsite.com/frontend/build;
index index.html index.htm;
location / {
try_files $uri $uri/ index.html;
}
}
server {
listen 80;
listen [::]:80 ipv6only=on;
root /var/www/mywebsite.com/backend/public;
index index.php index.html index.htm;
server_name api.mywebsite.com;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
What Am i doing to get nginx working with react router?