sudo apt install ncdu -y
sudo ncdu /
serverning to'liq xotirasini ko'rsatadigan funksiya juda foydali ekan sizlarga ham ulashyapman )
Postgresql ni Ubuntu serverga o'rnatish va sozlash.
1️⃣ Serverni yangilash
2️⃣ PostgreSQL o‘rnatish
3️⃣ Xizmatni tekshirish
4️⃣ Postgres foydalanuvchisi orqali kirish
5️⃣ Parol qo‘yish
6️⃣ Yangi baza yaratish
7️⃣ Chiqish
8️⃣ Ulanishni sozlash (masofadan kirish kerak bo‘lsa)
Config fayllar odatda shu yerda bo‘ladi:
/etc/postgresql/16/main/postgresql.conf
/etc/postgresql/16/main/pg_hba.conf
Masalan, postgresql.conf ichida:
qilib qo‘yiladi.
pg_hba.conf faylida:
Keyin serverni qayta ishga tushiramiz:
1️⃣ Serverni yangilash
sudo apt update && sudo apt upgrade -y
2️⃣ PostgreSQL o‘rnatish
sudo apt install postgresql postgresql-contrib -y
3️⃣ Xizmatni tekshirish
sudo systemctl status postgresql
4️⃣ Postgres foydalanuvchisi orqali kirish
sudo -i -u postgres
psql
5️⃣ Parol qo‘yish
\password postgres
6️⃣ Yangi baza yaratish
CREATE DATABASE mydb;
CREATE USER myuser WITH ENCRYPTED PASSWORD 'mypassword';
GRANT ALL PRIVILEGES ON DATABASE mydb TO myuser;
7️⃣ Chiqish
\q
exit
8️⃣ Ulanishni sozlash (masofadan kirish kerak bo‘lsa)
Config fayllar odatda shu yerda bo‘ladi:
/etc/postgresql/16/main/postgresql.conf
/etc/postgresql/16/main/pg_hba.conf
Masalan, postgresql.conf ichida:
listen_addresses = '*'
qilib qo‘yiladi.
pg_hba.conf faylida:
host all all 0.0.0.0/0 md5
Keyin serverni qayta ishga tushiramiz:
sudo systemctl restart postgresql
Steps to deploy a Node.js app to Ubuntu Server using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt
https://gist.github.com/FirdavsCoder/fa17d1ce8e84f5ad1856a1752321d35c
https://gist.github.com/FirdavsCoder/fa17d1ce8e84f5ad1856a1752321d35c
Gist
Node.js Deployment
Node.js Deployment. GitHub Gist: instantly share code, notes, and snippets.
server {
server_name miniapp-dev.suvgo.uz;
client_max_body_size 100M;
charset utf-8;
location /_next/static/ {
alias /var/www/suvgo-miniapp/dev/.next/static/;
expires 1y;
access_log off;
add_header Cache-Control "public, max-age=31536000, immutable";
}
location / {
proxy_pass http://localhost:6006;
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;
}
}NEXT JS NGINX CONFIGURATION