Complete Guide: Installing Paperless-ngx with CloudPanel
Are you looking to go paperless and want to set up Paperless-ngx alongside your CloudPanel installation? This comprehensive guide will walk you through the entire process, from installation to troubleshooting common issues.
Prerequisites
Before we begin, ensure you have:
- A server running Ubuntu 22.04/24.04 with SSH access
- CloudPanel already installed and configured
- Basic familiarity with command line operations
- A domain or subdomain pointed to your server’s IP address
Part 1: Initial Setup
Step 1: Download and Prepare the Installation Script
First, let’s download our installation script:
mkdir -p /docker/scripts
cd /docker/scripts
wget https://git.hhf.technology/hhf/paperless_ngx_cloudpanel/raw/branch/main/paperless-install.sh
chmod +x paperless-install.sh
Step 2: Configure Installation Parameters
Before running the script, you might want to modify some default settings. Open the script in your preferred editor:
nano paperless-install.sh
Key parameters you might want to customize:
INSTALL_DIR
: Default is “/docker/paperless-ngx”PAPERLESS_TIME_ZONE
: Set to your timezonePAPERLESS_OCR_LANGUAGE
: Default is “eng”
Step 3: Run the Installation Script
Execute the script with root privileges:
sudo ./paperless-install.sh
The script will:
- Check for and install Docker if needed
- Set up necessary directories
- Create and configure Docker containers
- Initialize the database
- Create a superuser account
Part 2: CloudPanel Configuration
Step 1: Create a New Site in CloudPanel
- Log into your CloudPanel dashboard
- Click “Sites” → “+ Add Site”
- Select “Reverse Proxy” as the site type
- Enter your domain (e.g., paperless.yourdomain.com)
- In the “Reverse Proxy URL” field, enter:
http://localhost:8000
- Click “Create”
Step 2: Configure SSL Certificate
- Go to the SSL/TLS section of your new site
- Click “+ Create Let’s Encrypt Certificate”
- Follow the prompts to generate your certificate
Part 3: Common Issues and Troubleshooting
Issue 1: Docker Container Won’t Start
If you see errors about containers not starting:
# Check container logs
docker logs paperless-ngx-webserver-1
# Verify container status
docker ps -a
# Try restarting the container
docker compose restart webserver
Issue 2: Database Connection Issues
If you encounter database connection problems:
- Check if the database container is running:
docker ps | grep paperless-ngx-db
- Verify database credentials in docker-compose.yml:
cat /docker/paperless-ngx/docker-compose.yml | grep POSTGRES
Issue 3: OCR Not Working
If document OCR isn’t functioning:
- Check OCR language settings:
docker compose exec webserver ls /usr/share/tesseract-ocr/4.00/tessdata/
- Add additional languages by modifying docker-compose.yml:
environment:
PAPERLESS_OCR_LANGUAGE: eng+fra+deu # Add languages as needed
Issue 4: CloudPanel Proxy Error
If you get a 502 Bad Gateway error:
- Verify Paperless-ngx is running:
curl http://localhost:8000
- Check CloudPanel nginx logs:
tail -f /var/log/nginx/error.log
Issue 5: Memory Issues
If the system becomes slow or unresponsive:
- Check system resources:
docker stats
- Adjust container memory limits in docker-compose.yml:
services:
webserver:
deploy:
resources:
limits:
memory: 2G
Part 4: Optimization and Best Practices
Regular Maintenance
Set up these maintenance tasks:
- Regular backups:
# Add to crontab
0 2 * * * /docker/paperless-ngx/export-backup.sh
- Log rotation:
# Configure logrotate
cat > /etc/logrotate.d/paperless-ngx <<EOF
/var/log/paperless-install.log {
weekly
rotate 4
compress
missingok
notifempty
}
EOF
Performance Tuning
For better performance:
- Configure Redis cache:
environment:
PAPERLESS_TASK_WORKERS: 2
PAPERLESS_THREADS_PER_WORKER: 2
PAPERLESS_REDIS_URL: redis://broker:6379
- Optimize PostgreSQL:
services:
db:
command: postgres -c shared_buffers=256MB -c work_mem=16MB
Part 5: Updating Paperless-ngx
To update your installation:
cd /docker/paperless-ngx
docker compose pull
docker compose down
docker compose up -d
Conclusion
You now have a fully functional Paperless-ngx installation running behind CloudPanel! Remember to:
- Regularly backup your data
- Keep your system updated
- Monitor system resources
- Check logs periodically for any issues
For additional support:
- Visit the Paperless-ngx GitHub repository
- Join the community Discord server
- Check the CloudPanel documentation for proxy-specific configurations
Happy document managing!