This tutorial assumes you are using Ubuntu 18.04 or newer.
It will follow this structure:
https://mydomain.com/ // Web
https://admin.mydomain.com/ // Administration panel
https://api.mydomain.com/ // API server
- Copy and paste ReaderFront files under
/var/www/readerfront/
- NodeJS 13 or newer.
- MariaDB and create a Database
- NGINX
- A Domain with the follow subdomains:
api
andadmin
Before proceeding, there are some settings you will need to configure. To configure them, copy the .env.example
files to .env
and edit them on every project.
Remember to modify:
NODE_ENV=development
APP_URL=http://localhost:3000/
API_URL=http://localhost:8000/
REACT_APP_APP_URL=http://localhost:3000
REACT_APP_READER_PATH=http://localhost:8000
to
NODE_ENV=production
APP_URL=https://mydomain.com/
API_URL=https://api.mydomain.com/
REACT_APP_APP_URL=https://mydomain.com
REACT_APP_READER_PATH=https://api.mydomain.com
yarn install
Build project run:
yarn build:all
To migrate database and create the schema run:
yarn db:migrate
PM2 is a process manager for Node.js applications. PM2 makes it possible to daemonize applications so that they will run in the background as a service.
Use npm to install the latest version of PM2 on your server:
yarn global add pm2
The -g
option tells npm to install the module globally, so that it’s available system-wide.
pm2 start yarn --name "readerfront-api" -- prod:api
Check that the API is running at http://YOUR_SERVER_IP:8000/
pm2 start yarn --name "readerfront-web" -- prod:web
Check that the API is running at http://YOUR_SERVER_IP:3000/
Your application is running and listening on localhost, but you need to set up a way for your users to access it. We will set up the Nginx web server as a reverse proxy for this purpose.
Configure NGINX to serve admin
static files and reverse proxy api
and web
. Using this tool you should have a similar configuration like this:
Follow the Setup and Files
steps to configure Nginx and SSL (with certbot).
To move the static files to nginx run:
mv /var/www/readerfront/admin/build/* /var/www/admin.mydomain.com/
sudo systemctl reload nginx
remember to rename the domain name
To create the admin account go to https://admin.mydomain.com/auth/signup
and the account will be automatically activated. Then you can login https://admin.mydomain.com/auth/login
.