project: kizlyarsk username: amroll
sudo vi /etc/ssh/sshd_config
- change
PasswordAuthentication
fromno
toyes
- save and exit
- restart ssh
sudo systemctl restart ssh
ufw allow OpenSSH
ufw enable
ssh root@your_server_ip
adduser amroll
usermod -aG sudo amroll
rsync --archive --chown=amroll:amroll ~/.ssh /home/amroll
exit
ssh amroll@your_server_ip
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
source ~/.bashrc
nvm install 14
cd ~
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
sudo vi ~/.profile
and addexport PATH=~/.npm-global/bin:$PATH
source ~/.profile
nvm use --delete-prefix v14.18.1
<-- check the WARNING message in console log to correct the version numbersource ~/.profile
sudo apt update
sudo apt install postgresql postgresql-contrib -y
sudo -i -u postgres
sudo -u postgres createuser --interactive
sudo -u postgres createdb -O amroll kizlyarsk
sudo -u postgres psql
ALTER USER amroll PASSWORD 'password';
\q
sudo nano /etc/postgresql/12/main/postgresql.conf
- Change
listen_addresses
fromlocalhost
to*
sudo nano /etc/postgresql/12/main/pg_hba.conf
sudo ufw allow 5432/tcp
sudo systemctl restart postgresql
cd ~
mkdir www
cd www
git clone [email protected]:danieltorscho/strapi kizlyarsk
cd kizlyarsk
npm install
NODE_ENV=production npm run build
sudo ufw allow 1337/tcp
(latersudo ufw deny 1337
)
npm install pm2@latest -g
pm2 init
sudo vi ecosystem.config.js
and replace with following:
module.exports = {
apps: [
{
name: 'kizlyarsk',
cwd: '/home/amroll/www/kizlyarsk',
script: 'npm',
args: 'start',
env: {
NODE_ENV: 'production',
DATABASE_HOST: 'localhost', // database endpoint
DATABASE_PORT: '5432',
DATABASE_NAME: 'strapi', // DB name
DATABASE_USERNAME: 'your-name', // your username for psql
DATABASE_PASSWORD: 'password', // your password for psql
},
},
],
};
pm2 start ecosystem.config.js
pm2 startup systemd
and copy the output as suggested in terminalsudo env PATH=$PATH:/home/amroll/.nvm/versions/node/v14.18.1/bin /home/amroll/.nvm/versions/node/v14.18.1/lib/node_modules/pm2/bin/pm2 startup systemd -u amroll --hp /home/amroll
pm2 save
sudo apt install nginx -y
sudo ufw allow 'Nginx HTTP'
systemctl status nginx
sudo systemctl stop nginx
sudo nano /etc/nginx/sites-available/kizlyarsk
sudo ln -s /etc/nginx/sites-available/kizlyarsk /etc/nginx/sites-enabled/
sudo nano /etc/nginx/nginx.conf> server_names_hash_bucket_size 64;
sudo nginx -t
sudo systemctl restart nginx