NODE_ENV=production
PORT=5555
DATABASE_HOST=localhost
DATABASE_PORT=3306
DATABASE_NAME=strapi_database
DATABASE_USERNAME=root
DATABASE_PASSWORD=password
DATABASE_SSL=false
- Clone the project in your local directory
- Create an
.env
file in the root directory and write the variables as mentioned above - Create a database in your database server with the same name you wrote in .env
- Now time to run the project:
Development mode | Production mode |
---|---|
1. Set NODE_ENV=development in .env |
1. Set NODE_ENV=production in .env |
2. Run sudo npm run develop |
2. Run sudo npm run start |
3. If you want to keep the app running in background as process then start it with this command instead following point number 2. Run sudo pm2 start npm --name "GIVE_A_NAME_YOU_LIKE" -- run develop ( pm2 must have to be installed) |
3. If you want to keep the app running in background as process then start it with this command instead following point number 2. Run sudo pm2 start npm --name "GIVE_A_NAME_YOU_LIKE" -- run start ( pm2 must have to be installed) |