I've been trying for a few days to configure my Hostinger vps to be able to put my React website on it. I wanted to use CloudPanel, which promised a quick and easy solution. Unfortunately, when I go to my domain name, I get this error: "502 Bad Gateway nginx" My domain name does point to the vps and I haven't touched the rest of the vps. I've repeated the procedure several times to make sure I haven't missed anything, but it doesn't work. I also tested using 'OpenLiteSpeed Node.js', and when I went to my domain, I had the welcome message displayed. I don't understand why CloudPanel isn't working. Could you help me understand what's missing? Thanks in advance
I tested using 'OpenLiteSpeed Node.js', and when I went to my domain, I had the welcome message displayed. I put the ssl_certificates on the nginx_conf Start nginx
Important points to consider:
/home/<site_user>/htdocs/<domain_name>/<repo_folder>/build
properly.location / {}
replaceproxy_pass http://localhost:{{port}};
bytry_files $uri $uri/ /index.html;
Since, the NodeJS app is working but not the react app is because the react app is not being severed in http://localhost:3000. Instead the react app is being severed as static html site. If the react app is being severed in any port, use the same port in the Cloud panel UI instead of doing step 3.
Hope it helps!