$ ssh-keygen -t rsa -b 4096
ssh-keygen -t rsa -b 4096
ssh-keygen -t rsa -b 4096
ssh root@YOUR_SERVER_IP_ADDRESS
ssh root@YOUR_SERVER_IP_ADDRESS
ssh root@YOUR_SERVER_IP_ADDRESS
ssh root@YOUR_SERVER_IP_ADDRESS
ssh root@YOUR_SERVER_IP_ADDRESS
ssh root@YOUR_SERVER_IP_ADDRESS
adduser your_username
adduser your_username
adduser your_username
usermod -aG -weight: 600;">sudo your_username
usermod -aG -weight: 600;">sudo your_username
usermod -aG -weight: 600;">sudo your_username
exit
ssh your_username@YOUR_SERVER_IP_ADDRESS
exit
ssh your_username@YOUR_SERVER_IP_ADDRESS
exit
ssh your_username@YOUR_SERVER_IP_ADDRESS
-weight: 600;">sudo -weight: 500;">apt -weight: 500;">update
-weight: 600;">sudo -weight: 500;">apt -weight: 500;">update
-weight: 600;">sudo -weight: 500;">apt -weight: 500;">update
-weight: 600;">sudo nano /etc/ssh/sshd_config
-weight: 600;">sudo nano /etc/ssh/sshd_config
PermitRootLogin no
PermitRootLogin no
-weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">restart sshd
-weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">restart sshd
-weight: 600;">sudo ufw allow OpenSSH # Or -weight: 600;">sudo ufw allow 22/tcp if you didn't change the port
# If you changed the SSH port (e.g., to 2222):
# -weight: 600;">sudo ufw allow 2222/tcp
-weight: 600;">sudo ufw allow http # Port 80 for web traffic
-weight: 600;">sudo ufw allow https # Port 443 for secure web traffic
-weight: 600;">sudo ufw allow OpenSSH # Or -weight: 600;">sudo ufw allow 22/tcp if you didn't change the port
# If you changed the SSH port (e.g., to 2222):
# -weight: 600;">sudo ufw allow 2222/tcp
-weight: 600;">sudo ufw allow http # Port 80 for web traffic
-weight: 600;">sudo ufw allow https # Port 443 for secure web traffic
-weight: 600;">sudo ufw -weight: 500;">enable
-weight: 600;">sudo ufw -weight: 500;">enable
-weight: 600;">sudo ufw -weight: 500;">status
-weight: 600;">sudo ufw -weight: 500;">status
-weight: 600;">sudo -weight: 500;">apt -weight: 500;">update
-weight: 600;">sudo -weight: 500;">apt -weight: 500;">upgrade -y
-weight: 600;">sudo -weight: 500;">apt -weight: 500;">update
-weight: 600;">sudo -weight: 500;">apt -weight: 500;">upgrade -y
-weight: 600;">sudo -weight: 500;">apt -weight: 500;">update
-weight: 600;">sudo -weight: 500;">apt -weight: 500;">upgrade -y
-weight: 600;">sudo -weight: 500;">apt -weight: 500;">install nginx -y
-weight: 600;">sudo -weight: 500;">apt -weight: 500;">install nginx -y
-weight: 600;">sudo -weight: 500;">apt -weight: 500;">install nginx -y
-weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">status nginx
-weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">status nginx
-weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">status nginx
-weight: 500;">curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/-weight: 500;">install.sh | bash
-weight: 500;">curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/-weight: 500;">install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
nvm -weight: 500;">install --lts
nvm use --lts
nvm alias default 'lts/*' # Set default for new sessions
nvm -weight: 500;">install --lts
nvm use --lts
nvm alias default 'lts/*' # Set default for new sessions
node -v
-weight: 500;">npm -v
node -v
-weight: 500;">npm -v
-weight: 600;">sudo -weight: 500;">npm -weight: 500;">install pm2 -g
-weight: 600;">sudo -weight: 500;">npm -weight: 500;">install pm2 -g
-weight: 600;">sudo -weight: 500;">npm -weight: 500;">install pm2 -g
cd /path/to/your/app
-weight: 500;">npm -weight: 500;">install # Install dependencies
pm2 -weight: 500;">start your_app_entry_file.js --name "my-cool-app"
cd /path/to/your/app
-weight: 500;">npm -weight: 500;">install # Install dependencies
pm2 -weight: 500;">start your_app_entry_file.js --name "my-cool-app"
cd /path/to/your/app
-weight: 500;">npm -weight: 500;">install # Install dependencies
pm2 -weight: 500;">start your_app_entry_file.js --name "my-cool-app"
pm2 logs my-cool-app
pm2 logs my-cool-app
-weight: 600;">sudo nano /etc/nginx/sites-available/default
-weight: 600;">sudo nano /etc/nginx/sites-available/default
server { listen 80; server_name YOUR_SERVER_IP_ADDRESS or your_domain.com; location / { proxy_pass http://localhost:3000; # Assuming your app runs on port 3000 proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection '-weight: 500;">upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; }
}
server { listen 80; server_name YOUR_SERVER_IP_ADDRESS or your_domain.com; location / { proxy_pass http://localhost:3000; # Assuming your app runs on port 3000 proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection '-weight: 500;">upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; }
}
-weight: 600;">sudo nginx -t
-weight: 600;">sudo -weight: 500;">systemctl reload nginx
-weight: 600;">sudo nginx -t
-weight: 600;">sudo -weight: 500;">systemctl reload nginx - CPU (vCores): This is your processing power. For basic web servers, a single vCore might suffice. For anything more demanding, like running databases, CI/CD pipelines, or multiple applications, you'll want at least 2 vCores. Don't get too hung up on the GHz; the architecture and number of cores are often more important.
- RAM (Memory): Crucial for performance, especially for applications that hold data in memory (databases, caches, Node.js apps). 1GB is the absolute minimum for a very light server. 2GB is a good starting point for most web applications. 4GB and above opens up more possibilities.
- Storage (SSD vs. HDD): Always opt for SSD (Solid State Drive) if possible, even in budget plans. The performance difference is night and day for disk I/O operations, which are critical for everything from booting up your OS to serving web pages. NVMe SSDs are even faster, but less common on the absolute cheapest tiers.
- Bandwidth: This is the amount of data you can transfer to and from your server per month. If you're hosting a high-traffic website or serving large files, this is a critical metric. Most budget plans offer generous amounts (e.g., 1TB or more), but it's worth checking.
- Operating System: Most providers offer a choice of Linux distributions (Ubuntu, CentOS, Debian, etc.) and sometimes Windows. Linux is generally more resource-efficient and preferred for server environments. - PowerVPS: They often have competitive pricing for their entry-level plans, making them a solid choice for developers starting out or managing smaller projects. Their network performance has been consistent in my experience.
- Immers Cloud: I've also had positive experiences with Immers Cloud. They offer a range of plans that strike a good balance between cost and performance, and their signup process is straightforward. - Billing Cycles: Many providers offer discounts for longer commitments (quarterly, annually). Weigh the savings against your need for flexibility.
- Setup Fees: Some providers might have hidden setup fees, though this is less common with VPS.
- Add-ons: Be wary of expensive add-ons like dedicated IP addresses or advanced control panels if you don't strictly need them. You can often manage without them.
- Location: Choose a server location geographically close to your target audience to minimize latency. - Disable Root Login: Edit the SSH configuration file. -weight: 600;">sudo nano /etc/ssh/sshd_config Find the line PermitRootLogin yes and change it to: PermitRootLogin no
- Change Default SSH Port (Optional but Recommended): This is a common security practice to reduce automated attacks. Change Port 22 to a different port number (e.g., Port 2222). IMPORTANT: If you change the port, remember to use ssh your_username@YOUR_SERVER_IP_ADDRESS -p 2222 to connect. You'll also need to -weight: 500;">update your firewall rules.
- Restart SSH Service: Apply the changes. -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">restart sshd - Allow essential ports: -weight: 600;">sudo ufw allow OpenSSH # Or -weight: 600;">sudo ufw allow 22/tcp if you didn't change the port
# If you changed the SSH port (e.g., to 2222):
# -weight: 600;">sudo ufw allow 2222/tcp
-weight: 600;">sudo ufw allow http # Port 80 for web traffic
-weight: 600;">sudo ufw allow https # Port 443 for secure web traffic
- Enable UFW: -weight: 600;">sudo ufw -weight: 500;">enable Confirm with y.
- Check -weight: 500;">status: -weight: 600;">sudo ufw -weight: 500;">status You should see your allowed rules. - Install nvm: -weight: 500;">curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/-weight: 500;">install.sh | bash Close and reopen your SSH session, or run: export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
- Install a Node.js version (e.g., LTS): nvm -weight: 500;">install --lts
nvm use --lts
nvm alias default 'lts/*' # Set default for new sessions
- Verify installation: node -v
-weight: 500;">npm -v - Cloning your repository (e.g., from GitHub).
- Installing dependencies (-weight: 500;">npm -weight: 500;">install).
- Building your application if necessary.
- Running your application. - List running processes: pm2 list
- View logs: pm2 logs my-cool-app
- Configure Nginx to Proxy Pass: You'll need to configure Nginx to forward requests from port 80 to your Node.js application running on a different port (e.g., 3000). Edit the default Nginx site configuration: -weight: 600;">sudo nano /etc/nginx/sites-available/default Modify the server block to include a location block that proxies requests to your app: server { listen 80; server_name YOUR_SERVER_IP_ADDRESS or your_domain.com; location / { proxy_pass http://localhost:3000; # Assuming your app runs on port 3000 proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection '-weight: 500;">upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; }
} Test Nginx configuration and reload: -weight: 600;">sudo nginx -t
-weight: 600;">sudo -weight: 500;">systemctl reload nginx - Regular Updates: Keep your OS and installed software up-to-date to patch security vulnerabilities.
- Resource Monitoring: Keep an eye on CPU, RAM, and disk usage. Tools like htop (-weight: 500;">install with -weight: 600;">sudo -weight: 500;">apt -weight: 500;">install htop) are invaluable for real-time monitoring. If you're consistently hitting resource limits, it might be time to -weight: 500;">upgrade your plan or optimize your application.
- Backups: Crucially, implement a backup strategy. Your VPS provider might offer backup services, or you can set up your own scripts to copy important data to a remote location. Don't skip this! - Performance Bottlenecks: If your server is constantly struggling, even after optimization, it's likely time for more resources.
- Unreliable Network: Frequent packet loss or high latency can be a sign of an overloaded network at the provider's end.
- Support Issues: While budget hosts often have limited support, if you encounter persistent issues that hinder your ability to manage your server, it might be time to consider other options.