Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React app showing page with "404 the requested path could not be found" when using Apache

I am deploying a React app to my Apache server.

I can access the app on my-ip:5001, but when I go to my domain it gives me "404 the requested path could not be found". Btw. the domain has been set up and worked with an html file before working with react.

enter image description here

I did npm run build and placed the build folder in the root of my server. Made no changes to the package.json file.

I run the server using: serve -s -l 5001

Apache conf file:

<IfModule mod_ssl.c>
<VirtualHost *:443>    
        ServerName somedomain.com
        ServerAlias www.somedomain.com



ProxyRequests On
ProxyVia On
<Proxy *>
  Order deny,allow
  Allow from all
  </Proxy>

        ProxyPass / http://localhost:5001/
        ProxyPassReverse / http://localhost:5001/



</VirtualHost>
</IfModule>

Any idea what might be going on here?

like image 290
DevB2F Avatar asked Nov 16 '22 06:11

DevB2F


1 Answers

run serve -s from inside of the /build folder. exemple

C:\Users\zafriha\Desktop\myProject>build>cd..

C:\Users\zafriha\Desktop\myProject>npm install -g serve

C:\Users\zafriha\Desktop\myProject>serve -s build

like image 86
Ait Friha Zaid Avatar answered Dec 06 '22 05:12

Ait Friha Zaid