We have hosted next JS app in Cloudways Linode server via pm2. The page is working properly in localhost but showing 404 error in server. The screenshot of the page is as below:
The .htacess
file is as below:
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)?$ http://127.0.0.1:3002/$1 [P,L]
The package json is as below:
{
"name": "sb",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev -p 3002",
"build": "next build",
"start": "next start -p 3002",
"lint": "next lint"
},
"dependencies": {
"next": "13.0.0",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"eslint": "8.26.0",
"eslint-config-next": "13.0.0"
}
}
Kindly let us know what changes has to be done to make next JS app show index.js
page
We tried npm export, changing .htaccess
file and changing port but it is still showing 404 error. I also tried creating test.js
page inside root folder and opening in browser it is running properly. But next JS index page not showing.