Installing CapRover on a VPS involves deploying Docker, initializing CapRover via a script, and subsequently configuring domains, SSL certificates, and application deployment, which enables you to get a powerful, self-hosted PaaS platform, similar to Heroku, but under your full control.
In the world of application development and deployment, speed and efficiency are crucial. Developers are constantly looking for tools that simplify the process from writing code to launching it in production. CapRover is one such solution, offering a powerful and free PaaS platform that can be deployed on your own server. This tool automates many routine tasks, such as CI/CD setup, domain management, SSL certificate issuance, and application scaling, making it an ideal choice for those who want a Heroku-like experience without expensive monthly subscriptions.
In this article, we will delve into what CapRover is, what it's used for, its system requirements, and walk through a step-by-step process of installing and configuring it on a VPS. We will cover aspects of reverse proxy, HTTPS, backup, and updates, and provide specific recommendations for choosing a VPS configuration for various workloads. If you are looking for a way to simplify the deployment of your web applications and microservices while remaining the owner of your data and infrastructure, then CapRover on VPS is exactly what you need.
What is CapRover and why choose it for your VPS?
CapRover is an open-source PaaS (Platform as a Service) solution that allows you to easily deploy, run, and scale applications on your own server. Essentially, it's a "self-hosted Heroku" that you can install on any VPS or dedicated server. It's built on Docker and Nginx, providing an intuitive web interface and a powerful CLI for managing your projects.
The main idea behind CapRover is to allow developers to focus on code, not infrastructure. Instead of manually configuring Nginx, managing SSL certificates, setting up Docker containers, and CI/CD pipelines, CapRover takes on these tasks. You simply tell CapRover where your code is (e.g., a Git repository, Dockerfile, or compiled archive), and it handles everything else.
Key advantages of CapRover on your VPS:
- Ease of Deployment: CapRover significantly simplifies the deployment process. You can deploy an application directly from a Git repository, Dockerfile, or by uploading a ready-made Tarball.
- Automatic HTTPS: CapRover is integrated with Let's Encrypt, automatically issuing and renewing SSL certificates for your domains, ensuring a secure connection without manual configuration.
- Scaling: You can easily scale your applications by adding or removing container instances directly from the control panel.
- Out-of-the-box CI/CD: Support for automatic deployment with every push to a Git repository.
- Free and Open Source: Unlike commercial PaaS providers, CapRover does not charge for usage. You only pay for your VPS.
- Full Control: Since CapRover is self-hosted, you have complete control over your infrastructure, data, and configurations. This is especially important for projects with high security requirements or specific settings.
- Docker Support: CapRover uses Docker for application isolation, ensuring portability and stability. This allows you to use any programming languages and frameworks that can be packaged into a Docker container.
Choosing CapRover for deployment on your VPS from Valebyte.com allows you to get a powerful and flexible platform that will grow with your projects, while ensuring cost-effectiveness and full control. This approach is particularly beneficial for startups, individual developers, and small businesses who are not ready to pay high fees for cloud PaaS solutions but need their functionality.
System Requirements for CapRover on VPS: Which server to choose?
Before proceeding with CapRover installation, it's important to ensure that your VPS meets the minimum system requirements. Although CapRover is quite lightweight, its performance directly depends on server resources, especially when you start deploying multiple applications or high-load applications. Remember that CapRover itself consumes some resources, in addition to the requirements of your applications and databases.
Minimum Requirements for CapRover:
- Operating System: Ubuntu 18.04 LTS or newer, Debian 9 or newer, CentOS 7 or newer. A fresh version of Ubuntu Server is recommended.
- Processor (CPU): 1 vCPU. This is sufficient for running CapRover and a few small, low-load applications.
- Random Access Memory (RAM): 1 GB. This is the absolute minimum. If you plan to run anything beyond the simplest static sites, you will need more.
- Disk Space: 25 GB. Docker images and logs can quickly fill up the disk. An NVMe disk is recommended for better performance.
- Public IP Address: Required. CapRover must be accessible from the internet for domain and SSL certificate management.
- Open Ports: 80 (HTTP), 443 (HTTPS), 3000 (CapRover control panel). Ensure your firewall allows incoming connections on these ports.
Recommendations for choosing a VPS for various workloads:
The choice of optimal VPS configuration for CapRover on the server depends on the type and number of applications you plan to host, as well as the expected load. The table below provides recommendations:
| Project Type | CPU (vCores) | RAM (GB) | Disk (GB, NVMe) | Approximate VPS Cost (USD/month) | Notes |
|---|---|---|---|---|---|
| Starter (test, static sites, 1-2 low-load microservices) | 1-2 | 2-4 | 50 | $5 - $15 | Ideal for experiments and personal projects. |
| Small/Medium (several web applications, APIs, small databases, up to 1000 requests/min) | 2-4 | 4-8 | 80-160 | $15 - $40 | Suitable for most startups and small production projects. |
| Medium/High (complex web services, databases, high-load APIs, up to 10000 requests/min) | 4-8 | 8-16 | 160-320 | $40 - $80 | For projects with constantly growing load and mission-critical services. |
| High-Load/Enterprise (many services, clustered databases, millions of requests/day) | 8+ | 16+ | 320+ | $80+ (may require a dedicated server) | For very large projects, it might be worth considering multiple VPS or a dedicated server. |
Important notes:
- NVMe Disks: Always choose a VPS with NVMe disks. Read/write speed significantly impacts the performance of Docker containers, databases, and overall application response time.
- Location: Choose a data center located closer to your target audience to minimize latency.
- Backups: Ensure your hosting provider offers reliable backup solutions or configure them yourself.
- Monitoring: For production projects, it is crucial to set up monitoring for VPS resources and application status.
Valebyte.com offers a wide range of VPS plans that are ideal for deploying CapRover, from budget solutions for testing to powerful configurations for high-load production systems. You can find a suitable plan that meets your requirements and budget, while ensuring high performance and reliability.
Looking for a reliable server for your projects?
VPS from $10/month and dedicated servers from $9/month with NVMe, DDoS protection, and 24/7 support.
View offers →Step-by-Step CapRover Installation on VPS with Docker and Docker Compose
CapRover installation on a VPS is a relatively straightforward process that involves several key steps: server preparation, Docker installation, and finally, CapRover initialization. We will use SSH to connect to your VPS and execute commands.
1. Server Preparation
Before you begin, ensure you have SSH access to your VPS with root privileges or a user with sudo privileges. As an example, we will use commands for Ubuntu/Debian.
System Update:
Always start by updating the package manager and installed packages to get the latest versions and security fixes.
sudo apt update && sudo apt upgrade -y
Firewall Configuration (UFW):
UFW (Uncomplicated Firewall) is an easy-to-use firewall for Linux. CapRover requires open ports 80, 443, and 3000.
sudo apt install ufw -y
sudo ufw allow OpenSSH
sudo ufw allow http
sudo ufw allow https
sudo ufw allow 3000/tcp
sudo ufw enable
sudo ufw status
Ensure that the output of sudo ufw status shows that the firewall is active and ports 80, 443, 3000, and OpenSSH are allowed.
2. Install Docker and Docker Compose
CapRover is entirely dependent on Docker, so installing CapRover Docker is a mandatory step. We will install Docker Engine and Docker Compose.
Install Docker Engine:
To install Docker, it is recommended to use the official script, which ensures correct installation of the latest versions.
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
After installation, check the Docker status:
sudo systemctl status docker
The output should show that Docker is active (active (running)).
Install Docker Compose:
Docker Compose allows you to define and run multi-container Docker applications. It is necessary for CapRover to function.
sudo apt install docker-compose -y
Check the installed Docker Compose version:
docker-compose --version
If you encounter issues or want to delve deeper into containerization, check out our article Containers vs. VMs vs. Bare-metal: The Hosting Landscape 2026.
3. Initialize CapRover
Now that Docker is installed, you can proceed with CapRover initialization. This is done with a single command.
Start CapRover:
sudo docker run -p 80:80 -p 443:443 -p 3000:3000 -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/caprover:/var/lib/caprover caprover/caprover
-p 80:80 -p 443:443 -p 3000:3000: Maps HTTP, HTTPS, and CapRover control panel ports from the container to the host system.-v /var/run/docker.sock:/var/run/docker.sock: Allows CapRover to interact with the Docker daemon on the host. This is critically important for its operation.-v /var/lib/caprover:/var/lib/caprover: Mounts a directory on the host to store CapRover data (configurations, SSL certificates, etc.). This directory must be persistent to retain data after a reboot.caprover/caprover: Specifies the CapRover Docker image.
After executing this command, CapRover will start loading. This process may take several minutes, as Docker will download the CapRover image and all necessary dependencies.
First login to CapRover control panel:
Open your web browser and navigate to your VPS's IP address with port 3000:
http://YOUR_IP_ADDRESS:3000
You will see the CapRover page. On your first login, you will be prompted to set an administrator password. Create a strong password. After that, you will enter the CapRover control panel.
Important Step: Setting the Root Domain
After the first login, CapRover will ask you to specify a "Root Domain". This is the primary domain that will be used to access the CapRover control panel and for automatic SSL certificate issuance. For example, if you want the control panel to be accessible at captain.yourdomain.com, and your applications at app1.yourdomain.com, then the "Root Domain" should be yourdomain.com.
- Register a domain name (if you don't have one).
- Create an A-record for your domain (e.g.,
*.yourdomain.comandyourdomain.com) or two separate A-records (captain.yourdomain.comand*.yourdomain.com) pointing to your VPS's IP address. This is crucial for CapRover to work with subdomains and automatic SSL. - Enter your domain (e.g.,
yourdomain.com) in the "Root Domain" field in the CapRover panel.
After setting the Root Domain, CapRover will automatically configure Nginx as a reverse proxy and attempt to issue an SSL certificate for your domain and subdomains via Let's Encrypt. This will allow you to access the control panel via HTTPS (e.g., https://captain.yourdomain.com).
Congratulations! You have successfully installed CapRover on your VPS. You are now ready to deploy your applications.
Need a dedicated server?
Compare prices from top providers. Configure and order in minutes.
Configuring Domains, HTTPS, and Reverse Proxy in CapRover
After successful CapRover installation and Root Domain setup, the next step is to configure domains for your applications, ensure HTTPS connections, and understand how CapRover manages the reverse proxy.
CapRover is designed to automate these processes as much as possible, using Nginx as the primary reverse proxy and Let's Encrypt for free SSL certificates.
1. Adding a Domain for Your Application
Each application you deploy in CapRover can have one or more of its own domains. To add a domain:
-
In the CapRover control panel:
- Go to the "Apps" section.
- Create a new application if you don't have one yet, or select an existing one.
- On the application page, go to the "Domain Configuration" section.
- In the "Custom Domain" field, enter the domain you want to use for this application (e.g.,
my-app.yourdomain.com). - Click "Update Domain & HTTPS".
-
DNS Settings:
- You need to create an A-record for this domain (
my-app.yourdomain.com) in your DNS provider's settings. This A-record must point to your CapRover VPS's IP address. - If you have already configured a wildcard A-record (e.g.,
*.yourdomain.com) pointing to your VPS, then this step can be skipped for subdomains, as CapRover will already handle them.
- You need to create an A-record for this domain (
CapRover will automatically detect that you have added a new domain for the application and will attempt to issue an SSL certificate for it via Let's Encrypt. This process usually takes a few minutes.
2. Automatic HTTPS with Let's Encrypt
One of CapRover's most attractive features is its built-in support for Let's Encrypt, which provides automatic issuance and renewal of free SSL/TLS certificates. This means that all your applications deployed via CapRover will, by default, run over HTTPS, which is critically important for security and SEO.
- When you add a domain to an application, CapRover automatically initiates the certificate acquisition process.
- It uses the HTTP-01 challenge, placing temporary files on your server to prove domain ownership.
- Upon successful verification, the certificate is issued and installed.
- CapRover also handles automatic certificate renewal before their expiration, freeing you from routine tasks.
Important: Ensure that ports 80 and 443 are open in your firewall and not used by other services on the VPS, as CapRover must have exclusive access to them to handle incoming HTTP/HTTPS requests and for Let's Encrypt to function.
3. How CapRover Manages Reverse Proxy (Nginx)
CapRover uses Nginx as a central reverse proxy for all your applications. When an external request arrives at your VPS (on ports 80 or 443), Nginx, configured by CapRover, intercepts it and routes it to the corresponding Docker container of your application. This happens as follows:
- The user requests
https://my-app.yourdomain.com. - The DNS record directs the request to your VPS's IP address.
- Nginx on your VPS (managed by CapRover) receives the request.
- Nginx checks the
Hostheader (my-app.yourdomain.com) and redirects the request to the internal IP address and port of the Docker container where your application is running. - The response from the application is returned via Nginx to the user.
CapRover automatically generates and manages Nginx configuration files for each application, eliminating the need for manual setup. This allows you to avoid common errors and significantly speeds up the deployment process.
4. Custom Nginx Configurations (Advanced)
While CapRover automates most Nginx settings, sometimes it may be necessary to add specific directives for your application (e.g., custom headers, CORS rules, redirects). CapRover provides a mechanism for this:
- On the application page, go to the "Nginx Configs" section.
- You can add additional Nginx directives that will be inserted into the
serverblock for your application.
# Example custom Nginx configuration for CapRover
# Adding CORS headers
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, HEAD' always;
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
# Redirect all HTTP requests to HTTPS (CapRover does this by default, but it can be reinforced)
if ($scheme = http) {
return 301 https://$host$request_uri;
}
Use this feature with caution, as incorrect settings can disrupt your application or CapRover's operation.
Thanks to this automation, CapRover significantly simplifies the management of multiple domains and SSL certificates on a single VPS, making it a powerful tool for developers who value their time and peace of mind.
Deploying Applications with CapRover: From Git to Production
Deploying applications with CapRover is one of its strengths, offering several flexible methods that suit various development scenarios. Whether it's a simple static site, a complex Node.js application, or a Python microservice, CapRover makes the deployment process fast and intuitive.
1. Deployment Options in CapRover
CapRover supports three main deployment methods:
a) Deploying from a Git Repository (most popular)
This is the most convenient method for most web applications, as it integrates with the developer's workflow. CapRover clones your repository, builds the application (if necessary), and runs it in a Docker container.
- Create Application: In the CapRover panel, go to "Apps" -> "Create New App". Enter the application name.
- Git Configuration: On the application page, go to the "Deployment" -> "Git Push" section.
- Repository URL: Enter the URL of your Git repository (e.g.,
https://github.com/youruser/yourrepo.git). If the repository is private, CapRover can use an SSH key or access token. - Branch: Specify the branch from which CapRover should deploy the application (usually
mainormaster). - Dockerfile or Build File:
- If you have a
Dockerfilein the root of your repository, CapRover will automatically use it. - If not, CapRover will try to determine the application type (Node.js, Python, PHP, etc.) and use built-in builders. For this, it looks for files like
package.json,requirements.txt,composer.json. - You can also specify the path to a
captain-definitionfile, which allows you to precisely configure the build and run process.
- If you have a
- Automatic Deploy: Enable the "Automatic Git Deploy" option for continuous integration. CapRover will provide a webhook URL that you can add to your Git provider's settings (GitHub, GitLab, Bitbucket). Every push to the specified branch will automatically trigger a new deployment.
b) Deploying using a Dockerfile
This method gives you maximum control over your application's build process and environment. You provide CapRover with a link to a repository containing a Dockerfile.
- Configuration is similar to Git deployment, but CapRover will look for and use your
Dockerfile. - This is ideal for complex applications, specific dependencies, or when you need very precise control over the image.
c) Deploying via Tarball (SFTP)
This method is suitable for applications that are already compiled or do not use Git. You upload an archive with your application to CapRover.
- On the application page, go to "Deployment" -> "Tarball (SFTP)".
- CapRover provides SFTP credentials. Use an SFTP client (e.g., FileZilla, WinSCP) to connect to your VPS.
- Upload your
tar.gzarchive to the specified directory. - After uploading, return to the CapRover panel and click "Deploy Now".
2. Deployment Examples:
Let's look at how this works for a simple Node.js application:
Example package.json for Node.js:
{
"name": "my-node-app",
"version": "1.0.0",
"description": "My first CapRover app",
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"dependencies": {
"express": "^4.18.2"
}
}
Example server.js:
const express = require('express');
const app = express();
const port = process.env.PORT || 80; // CapRover injects PORT
app.get('/', (req, res) => {
res.send('Hello from CapRover!');
});
app.listen(port, () => {
console.log(`App listening at http://localhost:${port}`);
});
CapRover will automatically detect package.json, install dependencies (npm install), and run the application with the npm start command, passing the PORT environment variable.
3. Environment Variables and Persistent Data
Environment Variables:
On each application's page in CapRover, there is an "Environment Variables" section. Here you can define environment variables that will be available to your application inside the container. This is ideal for storing API keys, database settings, and other sensitive data.
DB_HOST=my-database.yourdomain.com
DB_USER=root
DB_PASSWORD=secretpassword
These variables will be automatically injected into your application's container.
Persistent Data/Volumes:
By default, data inside a Docker container is ephemeral. If the container is deleted or updated, the data will be lost. To preserve data (e.g., uploaded files, logs), CapRover allows you to mount persistent volumes.
- In the "Persistent Data" section on the application page, you can specify a path inside the container that will be bound to persistent storage on your VPS.
- For example, if your application saves files to
/app/uploads, you can configure a volume to make this directory persistent.
4. Scaling and Monitoring
Scaling:
CapRover allows you to easily scale your applications horizontally. On the application page, in the "App Configs" section, you can change the "Instance Count". CapRover will automatically launch new containers and distribute the load among them using Nginx.
Monitoring:
CapRover provides basic CPU and RAM monitoring for each application. You can also view application logs in real-time. For more advanced monitoring, it is recommended to use external tools such as Prometheus/Grafana or cloud services deployed on your VPS.
Thanks to its integration with Docker and well-designed deployment tools, CapRover significantly simplifies the application development and operation lifecycle, allowing you to quickly move from idea to a working product.
CapRover Maintenance: Backups, Updates, and Security
Effective CapRover maintenance on your VPS is key to the stability, security, and long-term operability of your applications. This includes regular backups, timely updates, and applying best security practices.
1. CapRover Backup Strategies
Backup is a critically important aspect of any production server. For CapRover, several types of data need to be preserved:
a) Backup of CapRover Configurations and SSL Certificates
All important CapRover data, including application configurations, domains, and Let's Encrypt SSL certificates, are stored in the directory you mounted during installation (by default /var/lib/caprover). This is the most important directory for CapRover backups.
# Create an archive of CapRover data
sudo tar -czvf /root/caprover_backup_$(date +%Y%m%d%H%M%S).tar.gz /var/lib/caprover
It is recommended to automate this process using cron jobs and regularly move archives to remote storage (S3, Google Cloud Storage, remote SFTP server) to protect against data loss in case of a VPS failure.
b) Backup of Application Data (Persistent Data)
If your applications use persistent volumes, this data also needs to be backed up regularly. If you mounted them to /var/lib/caprover/data/app_name/..., they will be included in the general CapRover backup. If you use other paths, ensure they are also included in your backup script.
# Example backup of a specific application volume (if not in /var/lib/caprover)
sudo tar -czvf /root/myapp_data_backup_$(date +%Y%m%d%H%M%S).tar.gz /path/to/myapp/persistent/data
c) Database Backup
If you are running databases (PostgreSQL, MySQL, MongoDB) in separate containers or on the same VPS, they should be backed up separately using built-in database tools (pg_dump, mysqldump, mongodump). These dumps should also be saved to remote storage.
For a deeper understanding of working with databases on a VPS, you can refer to the article How to Migrate from Heroku Postgres to Managed PG on VPS.
2. Updating CapRover
CapRover updates are released regularly, bringing new features, performance improvements, and security fixes. The CapRover update process is usually very simple.
Update CapRover CLI:
npm install -g caprover@latest
Update CapRover Server:
The easiest way to update the CapRover server is to use the CLI command:
caprover update
This command will download the latest CapRover Docker image and restart the container. Your applications will remain available during the update, as CapRover uses a zero-downtime deployment strategy.
Important: Always back up /var/lib/caprover before major updates. While CapRover updates are generally reliable, it's better to be safe than sorry.
Also, don't forget to update your VPS's operating system:
sudo apt update && sudo apt upgrade -y
sudo apt autoremove -y
3. CapRover Server Security Basics
Securing your CapRover server is an ongoing process. Here are some key recommendations:
- Strong Passwords: Use complex, unique passwords for CapRover panel access and for SSH access to your VPS.
- SSH Keys: Disable password authentication for SSH and use only SSH keys. This significantly enhances security.
- Firewall: Ensure your firewall (UFW) is correctly configured and only necessary ports are open (80, 443, 3000, 22/SSH).
- Regular Updates: Keep CapRover, Docker, and your VPS's OS up to date. Updates often include critical security fixes.
- Application Isolation: Docker provides good isolation, but always ensure your applications do not have excessive privileges.
- Log Monitoring: Regularly review CapRover and your application logs for suspicious activity.
- Access Restriction: If possible, restrict access to the CapRover control panel (port 3000) only from specific IP addresses using firewall rules.
- Network Security: Use a VPN to access your VPS if you need maximum security. Learn how to set up Your Own VPN on VPS.
By following these recommendations, you can maintain your CapRover in a functional and secure state, providing a reliable platform for your applications.
Need a dedicated server?
Compare prices from top providers. Configure and order in minutes.
VPS Configuration Recommendations for CapRover Under Real-World Load
Choosing the right VPS configuration for CapRover on VPS is critically important for the performance and stability of your applications under real-world load. Insufficient resources can lead to delays, errors, and even service failures, while excessive resources result in unnecessary costs. Valebyte.com offers flexible VPS solutions that can be adapted to various needs.
Factors Influencing Configuration Choice:
- Number and Type of Applications: Static sites consume few resources, while dynamic applications with intensive computations or databases require significantly more.
- Expected Traffic: The number of concurrent users and requests per second directly impacts CPU and RAM consumption.
- Database Usage: Databases (especially relational ones) can be the most resource-intensive components, particularly for RAM and disk speed.
- Background Tasks and Queues: Tasks performed in the background (image processing, email sending) also consume resources.
- Complexity of Docker Images: Large Docker images take up more disk space and can take longer to start.
VPS Configuration Recommendations from Valebyte.com:
Below are specific VPS configuration recommendations based on typical CapRover usage scenarios. Always choose a VPS with NVMe disks for maximum I/O performance.
1. For Small Projects and Testing
- Examples: Personal blogs, portfolios, small APIs, static sites, test environments, 1-2 microservices with low traffic (up to 100-200 unique visitors per day).
- CPU: 2 vCores (e.g., Intel Xeon E5/E7 or AMD EPYC).
- RAM: 4 GB. This is sufficient for CapRover and a few lightweight containers.
- Disk: 50-80 GB NVMe. For Docker images, logs, and small data.
- Approximate Cost: From $10 to $20 per month.
- Justification: 2 vCores provide sufficient power for request processing, and 4 GB RAM helps avoid swapping under moderate load. An NVMe disk ensures fast container startup and responsive file system performance.
2. For Medium Projects and Small Production Systems
- Examples: SaaS applications for small businesses, online stores with moderate traffic (up to 1000-5000 unique visitors per day), several API services, medium-sized databases.
- CPU: 4 vCores.
- RAM: 8 GB. Allows more applications and database data to be held in memory.
- Disk: 160-240 GB NVMe. For growing data volumes, logs, and backups.
- Approximate Cost: From $20 to $40 per month.
- Justification: Increased CPU cores and RAM allow CapRover to efficiently manage a larger number of containers and handle peak loads without performance degradation.
3. For High-Load Projects and Cluster Solutions
- Examples: Large web portals, e-commerce platforms with high traffic (5000+ unique visitors per day), complex microservice architectures, databases with intensive read/write operations.
- CPU: 8+ vCores.
- RAM: 16+ GB. Significantly more may be required if you have large databases or memory-intensive applications.
- Disk: 320+ GB NVMe. Consider using separate disks or network storage for databases.
- Approximate Cost: From $50 to $100+ per month. In some cases, it might be more cost-effective to use a dedicated server.
- Justification: These configurations provide maximum performance for handling a large number of concurrent requests, complex computations, and intensive data operations. It may be necessary to distribute the load across multiple VPS and use external databases or object storage.
Additional Recommendations:
- Scalability: Start with the minimum acceptable configuration and scale resources up as the load grows. Valebyte.com offers flexible plans that allow for easy VPS upgrades.
- Monitoring: Be sure to set up monitoring systems (e.g., Prometheus + Grafana, Netdata) to track CPU, RAM, disk, and network usage. This will help you understand when it's time to increase resources.
- Backup: Regardless of project size, set up regular and automatic backups of all important data.
- Network: For high-load projects, pay attention to the VPS network channel's bandwidth.
Choosing the right VPS for your CapRover project is an investment in its stability and performance. Valebyte.com provides reliable infrastructure that will help your applications run flawlessly.
CapRover Optimization and Security Recommendations
To ensure your CapRover server operates as efficiently and securely as possible, you need to adhere to a set of best practices. These recommendations will help you optimize application performance, reduce security risks, and simplify platform management.
Performance Optimization:
-
Dockerfile Optimization:
- Use multi-stage builds to reduce the size of final Docker images. Smaller images download and start faster.
- Cache Docker layers by placing frequently changing commands (e.g., copying code) after stable ones (e.g., installing dependencies).
- Use official, minimal base images (e.g., Alpine versions) to reduce overhead.
-
Efficient Application Resource Usage:
- Configure CPU and RAM limits for each application in CapRover ("App Configs" -> "Container Configurations" section). This prevents "noisy neighbor" issues where one application consumes all resources.
- Optimize your application's code to minimize memory and CPU consumption. Profiling will help identify bottlenecks.
- Use caching (Redis, Memcached) for frequently requested data to reduce database and application load.
-
Nginx Configuration:
- While CapRover manages Nginx automatically, you can add custom directives for optimization, such as for Gzip compression (if CapRover doesn't do it by default) or for configuring static file caching.
- Ensure HTTP caching headers are correctly configured for static resources so client browsers cache them.
-
Resource Monitoring:
- Use CapRover's built-in CPU/RAM metrics, but for production systems, consider installing a full-fledged monitoring system on your VPS (e.g., Netdata, Prometheus + Grafana).
- Monitoring will help you identify anomalies, determine when scaling is needed, and understand which applications consume the most resources.
-
Database Optimization:
- Index database tables to speed up queries.
- Regularly clean and optimize databases.
- Consider using a separate VPS for databases if they become a bottleneck.
Security Enhancement:
-
Using SSH Keys and Disabling Password Authentication:
- For SSH access to your VPS, use only keys. Disable password login to prevent brute-force attacks.
- This is a fundamental step in server security.
-
Robust Firewall (UFW):
- Ensure UFW is correctly configured and only allows necessary ports: 22 (SSH), 80 (HTTP), 443 (HTTPS), 3000 (CapRover UI).
- Consider restricting access to CapRover UI port 3000 only from your work IP address.
-
Regular Updates:
- Keep your VPS operating system, Docker, and CapRover up to date. Updates often include critical vulnerability fixes.
- Automate OS updates if possible, but with caution to avoid unexpected failures.
-
Strong Passwords and Two-Factor Authentication:
- Use long, complex, and unique passwords for the CapRover panel.
- If CapRover supports it, enable two-factor authentication (2FA) for panel access.
-
Application Isolation:
- Docker inherently provides good isolation, but always ensure applications do not have more privileges than necessary.
- Avoid running containers with privileged access or mounting sensitive host directories unless absolutely necessary.
-
Environment Variable Protection:
- Do not store sensitive data (API keys, DB passwords) directly in your Git repository. Use CapRover environment variables.
- Regularly change these variables.
-
Backup:
- Regular backup is not only protection against failures but also a security element. If your server is compromised, you can restore from a clean backup.
-
Logging and Auditing:
- Set up centralized logging for your applications and CapRover. Regularly review logs for suspicious activity.
Applying these recommendations will allow you to create a stable, performant, and secure environment for your applications on CapRover on VPS.
Conclusion
CapRover on VPS is a powerful, flexible, and cost-effective solution for deploying and managing web applications, offering PaaS platform functionality under your full control. By following the detailed instructions for installation, domain configuration, HTTPS, and maintenance, you can create a reliable infrastructure for your projects. For optimal performance and security, choose a VPS from Valebyte.com with NVMe disks and sufficient RAM, scaling resources as your needs grow.
Ready to choose a server?
VPS and dedicated servers in 72+ countries with instant activation and full root access.
Get started now →