Gabi
Gabi

Reputation: 45

React app does not work with LiteSpeed Server

Package.json:

cat package.json
{
  "name": "react",
  "version": "0.0.0",
  "private": true,
  "main": "index.js",
  "dependencies": {
    "prop-types": "^15.8.1",
    "react": "^18.1.0",
    "react-dom": "^18.1.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  },
  "devDependencies": {
    "react-scripts": "latest"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

I have this .htaccess file:

DirectoryIndex ../../developement/eliptum-react/public/index.html
DO NOT REMOVE. CLOUDLINUX PASSENGER CONFIGURATION BEGIN

PassengerAppRoot "/home/eliptumr/developement"
PassengerBaseURI "/dev"
PassengerNodejs "/home/eliptumr/nodevenv/developement/20/bin/node"
PassengerAppType node
PassengerStartupFile ../../developement/eliptum-react/src/App.js
DO NOT REMOVE. CLOUDLINUX PASSENGER CONFIGURATION END

I have a running react app in /developement/eliptum-react

But when i access eliptum.tech/dev, it does indeed display the contents of index.html, which are:

`<head></head><body><div id="root"></div></body>`

But not rendering my react app

The host that i bought uses LiteSpeed webserver

I have a running react app in /developement/eliptum-react, it is started using npm run start

How should I go about setting up the app, am i missing something?

Upvotes: 0

Views: 296

Answers (1)

Gabi
Gabi

Reputation: 45

Answer here, posting link to reddit so the person who helped, gets credit!

TL'DR I wasn't building the app and using it like such, instead i was running a test server by executing npm run start(script), instead i should have used npm run build, to build the react app and use the resulting files for the webhost to serve

GG's!

https://www.reddit.com/r/reactjs/comments/18zgcl7/comment/kgin7s1/?context=3

Upvotes: 0

Related Questions