ssh-keygen -t rsa -b 2048cd ~/.ssh/cat id_rsa.pubssh -T git@github.comeval "$(ssh-agent -s)" in each new sessionsudo ufw enable
y and hit Enter
sudo ufw app list (to view available
apps)sudo ufw allow OpenSSH (replace
"OpenSSH" with your
desired app)
sudo chmod +x /usr/bin/python3docker run -p 5050:80 -e "PGADMIN_DEFAULT_EMAIL=admin@admin.com" -e "PGADMIN_DEFAULT_PASSWORD=admin" -d dpage/pgadmin4
docker ps
docker inspect <container_id> (replace <container_id> with
your actual container
ID)
pg_hba.conf file:
host all all 172.17.0.2/32 md5 (ensure you add "/32" for IPv4 or "/128"
for IPv6)
adduser user_name (Replace user_name with the desired
username. You will be
prompted to enter a password and additional information.)adduser user_name sudo (Grant sudo privileges to the new user)
su - postgrespsql\l (List all databases)\q (Quit PostgreSQL)wget https://go.dev/dl/go1.19.4.linux-amd64.tar.gztar -xvf golang_download_file_name.tar.gz (Replace
golang_download_file_name.tar.gz with the actual file name)sudo mv go /usr/local (Move Go to the local directory)cd and press
Enter to navigate to the tmp folder)sudo apt update && sudo apt -y full-upgradesudo rebootsudo apt updatesudo apt install curl gpg gnupg2 software-properties-common apt-transport-https lsb-release ca-certificates
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg
echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
sudo apt updatesudo apt install postgresql-13 postgresql-client-13sudo nano /etc/postgresql/13/main/postgresql.conf (replace "13"
with your PostgreSQL version)
postgresql.conf, set listen_addresses to your VPS IP
address. For example:
listen_addresses = '192.168.10.11'
pg_hba.conf:
sudo nano /etc/postgresql/13/main/pg_hba.conf
# Accept from anywhere
host all all 0.0.0.0/0 md5
To:
# Accept from trusted subnet
host all all 10.10.10.0/24 md5
pg_hba.conf.sudo systemctl restart postgresql
systemctl status <service_name> (e.g., nginx, mysql)systemctl restart <service_name>systemctl stop <service_name>
location / {
# First attempt to serve request as file, then
# as directory, then redirect to index(angular) if no file found.
try_files $uri $uri/ /index.html;
}
sudo chmod 777 -R Your_Dir/ (Replace Your_Dir with your
directory)sudo apt install nginxsudo ufw app list (to check if Nginx HTTP and Nginx HTTPS exist)
sudo ufw enablesudo ufw allow 'Nginx HTTP'sudo ufw allow 'Nginx HTTPS'systemctl status nginx (to check Nginx status)sudo mkdir -p /var/www/html/your_foldersudo chown -R $USER:$USER /var/www/your_foldersudo chmod -R 755 /var/www/your_foldersudo nano /etc/nginx/sites-available/your_domainyour_folder with your directory and
your_domain with your
domain name. Ignore sections managed by Certbot.
server {
root /var/www/your_folder;
index index.html index.htm index.nginx-debian.html;
server_name your_domain;
location / {
try_files $uri $uri/ /index.html;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/path/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/path/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = your_domain) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
listen [::]:80;
server_name your_domain;
return 404; # managed by Certbot
}
sudo ln -s /etc/nginx/sites-available/your_domain /etc/nginx/sites-enabled/
sudo nginx -thttp://localhost:3000/
with your application's
URL.
server {
server_name nodejs.your_domain.com;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:3000/;
proxy_redirect http://localhost:3000/ https://$server_name/;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/path/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/path/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = your_domain) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name your_domain;
return 404; # managed by Certbot
}
3000 or update the proxy
settings accordingly.sudo apt install snapdsudo snap install --classic certbot
certbot in your terminal: