via Apt-get

Cài curl

apt-get install curl

Cài Nodejs

apt-get install nodejs

Cài theo phiên bản (có cả npm)

# Using Ubuntu
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

# Using Debian, as root
curl -sL https://deb.nodesource.com/setup_8.x | bash -
apt-get install -y nodejs

via apk

Cài curl

apk add curl

Cài Nodejs

apk add nodejs

Cài pm2

npm i -g pm2
pm2 stop app_name_or_id
pm2 restart app_name_or_id
pm2 list
pm2 info example
pm2 monit

Nano

1) Lỗi sử dụng nano chỉnh sửa file

Error opening terminal: unknown.

Fix

export TERM=xterm

Cấu hình nginx

Path
/etc/nginx/conf.d# nano default.conf
Cấu hình mặc định là: localhost:80 và chạy file index.html
server {
    listen       80;
    server_name  localhost;

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }
}
location / { // '/' ở đây là localhost:80
        proxy_pass http://localhost:3001;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
   }

Cài node qua NVM

Cài nvm
yarnpkg

Dùng nvm cài node
nvm install 8.9.3

For Windows Server

Test: ./nginx.exe -c ./conf/nginx.conf -t
Test ok thì bỏ -t để chạy: ./nginx.exe -c ./conf/nginx.conf

Money Lover

Trường hợp có file config nginx từ domain khác thì copy

cp <file cần copy> <file mới>

Test config nginx xem ok chưa

/usr/local/nginx/sbin/nginx -c /etc/nginx/nginx.conf -t

Khi nginx đang chạy thì không nên restart, mà nên reload

systemctl reload nginx

results matching ""

    No results matching ""