Getting Started
Welcome to SnapEncode! This guide provides a comprehensive, step-by-step walkthrough for deploying your self-hosted video platform. We will cover all prerequisites, application setup, and media server configuration in detail.
System Requirements
Important: Ensure your server meets these minimum requirements before proceeding with installation.
CPU
4+ cores recommended
2 cores minimum
RAM
8GB recommended
4GB minimum
Storage
100GB+ SSD
Fast I/O essential
OS Support
Ubuntu 22.04 LTS
(Fully Supported)
Supported Operating Systems
- Ubuntu 22.04 LTS (Recommended & Fully Supported)
- Ubuntu 20.04 LTS (Compatible)
- Debian 11/12 (Compatible)
- CentOS 8+ (Community Support)
Network Requirements
- Bandwidth: 100 Mbps+ for HD streaming
- Ports: 80, 443, 1935 (RTMP), 8888 (Media API)
- UDP Range: 20000-21000 (WebRTC)
Who is this for?
SnapEncode is a powerful, self-hosted application. Successful installation and management require a strong understanding of Linux server administration and the Laravel ecosystem. While control panels (like cPanel or Plesk) can be used, you must have the ability to manage background processes, configure web servers, and handle command-line operations. A clean VPS or dedicated server running Ubuntu 22.04 is the recommended and fully supported environment.
Purchase & Support
Before you begin, you will need a license to use the SnapEncode software.
Buy on Snapencode
Purchase a license and download the source code from the official marketplace.
Contact Us for Help
Need help with installation, customization, or have a pre-sale question? We’re here to help.
Installation Method
Choose your preferred installation method. Docker is recommended for a streamlined, isolated setup. The Manual method offers maximum control for experienced administrators.
undefined
Phase 1: Server Preparation (Manual)
1. Install Core Dependencies
Use the commands for Ubuntu 22.04 (Recommended).
# Update package lists
sudo apt update && sudo apt upgrade -y
# Install Core Services
sudo apt install -y nginx mariadb-server redis-server supervisor
# Install PHP 8.2 and extensions
sudo apt install -y software-properties-common
sudo add-apt-repository ppa:ondrej/php -y
sudo apt update
sudo apt install -y php8.2-fpm php8.2-mysql php8.2-mbstring php8.2-xml php8.2-bcmath php8.2-curl php8.2-gd php8.2-zip php8.2-fileinfo php8.2-redis
# Install Media & System Tools
sudo apt install -y ffmpeg composer git unzip nodejs npm wget
# Nodejs
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install nodejs
# Install Shaka Packager
wget https://github.com/google/shaka-packager/releases/latest/download/packager-linux-x64
sudo chmod +x packager-linux-x64
sudo mv packager-linux-x64 /usr/local/bin/shaka-packager
# Whisper: This creates a new 'build' folder and moves you into it.
# bin is on snapencode project
cd ./bin/whisper
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make
cd .bin/models
# You should download small model type
./download-ggml-model.sh small
cd .bin/models
# You should download small model type
./download-ggml-model.sh small
2. Increase Upload Limits (Prevent 413 Errors)
Create a new PHP configuration file to increase upload limits for large video files.
sudo bash -c 'cat > /etc/php/8.2/fpm/conf.d/99-uploads.ini' <<EOF
file_uploads = On
upload_max_filesize = 10G
post_max_size = 10G
max_execution_time = 0
memory_limit = 2G
EOF
Apply the new PHP settings by restarting the PHP-FPM service.
sudo systemctl restart php8.2-fpm
3. Configure Firewall
Your server’s firewall must allow traffic on the following ports. If using ufw
:
sudo ufw allow 22/tcp # SSH
sudo ufw allow 80/tcp # HTTP
sudo ufw allow 443/tcp # HTTPS
sudo ufw allow 1935/tcp # RTMP Streaming
sudo ufw allow 8888/tcp # Media API
sudo ufw allow 20000:21000/udp # WebRTC
sudo ufw enable
4. Secure Your Database
Run the secure installation script, then create a dedicated database and user.
sudo mysql_secure_installation
Create the database and user:
# Log into MySQL as root
sudo mysql -u root -p
# Run these SQL commands
CREATE DATABASE snapencode CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'snapencode_user'@'localhost' IDENTIFIED BY 'your_strong_password_here';
GRANT ALL PRIVILEGES ON snapencode.* TO 'snapencode_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Phase 2: Application Setup (Manual)
1. Upload & Install
Upload the source code to /var/www/snapencode
. Then, install dependencies.
cd /var/www/snapencode
Customizing Frontend Assets (Optional): The following command is only necessary if you plan to modify the JavaScript or CSS files in the resources
directory. If you are just installing the application as-is, you can skip this step.
npm install && npm run build
Make the binary files executable:
chmod +x ./bin/*
2. Configure Environment (.env
)
Create and configure your .env
file for production.
cp .env.example .env
php artisan key:generate
Open nano .env
and edit the following settings:
APP_NAME=SnapEncode
APP_ENV=production
APP_DEBUG=false
APP_URL=https://your-domain.com
FRONTEND_URL=https://your-domain.com
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=snapencode
DB_USERNAME=snapencode_user
DB_PASSWORD=your_strong_password_here
BROADCAST_DRIVER=log
CACHE_DRIVER=redis
FILESYSTEM_DISK=local
QUEUE_CONNECTION=redis
SESSION_DRIVER=redis
SESSION_LIFETIME=120
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
FFMPEG_BINARIES=/usr/bin/ffmpeg
FFPROBE_BINARIES=/usr/bin/ffprobe
SHAKA_PACKAGER_BINARIES=/usr/local/bin/packager
3. Run Database Migrations
php artisan migrate --seed --force
php artisan storage:link
4. Optimize for Production
Critical Step: Run these commands only after you have finished configuring your .env
file. This caches your settings for a significant performance boost.
php artisan config:cache
php artisan route:cache
php artisan view:cache
5. Configure Nginx & Permissions
Set proper ownership and permissions:
sudo chown -R www-data:www-data /var/www/snapencode
sudo chmod -R 755 /var/www/snapencode
sudo chmod -R 775 /var/www/snapencode/storage /var/www/snapencode/bootstrap/cache
Create a new Nginx site configuration at /etc/nginx/sites-available/snapencode.conf
:
server {
listen 80;
server_name your-domain.com;
root /var/www/snapencode/public;
index index.php index.html;
# Security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header X-Content-Type-Options "nosniff" always;
# Increase upload limits for large video files
client_max_body_size 10G;
client_body_timeout 300s;
client_header_timeout 300s;
# Handle static files
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
# Main location block
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# PHP processing
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_read_timeout 300;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
}
# Deny access to sensitive files
location ~ /\. {
deny all;
}
}
Enable the site and secure it with SSL:
sudo ln -s /etc/nginx/sites-available/snapencode.conf /etc/nginx/sites-enabled/
sudo nginx -t
sudo apt install -y certbot python3-certbot-nginx
sudo certbot --nginx -d your-domain.com
sudo systemctl restart nginx
6. Configure Queue Worker (Supervisor)
Create a Supervisor config file at /etc/supervisor/conf.d/snapencode-worker.conf
:
[program:snapencode-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/snapencode/artisan queue:work redis --queue=high,default,video-encoding --timeout=0 --memory=2048 --tries=3
directory=/var/www/snapencode
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www-data
numprocs=2
redirect_stderr=true
stdout_logfile=/var/log/snapencode-worker.log
stdout_logfile_maxbytes=100MB
stdout_logfile_backups=5
Start the worker processes:
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start snapencode-worker:*
Verify the Worker Status:
sudo supervisorctl status
Expected output:
snapencode-worker:snapencode-worker_00 RUNNING pid 12345, uptime 0:01:15
snapencode-worker:snapencode-worker_01 RUNNING pid 12346, uptime 0:01:15
7. Configure Task Scheduling
The Laravel Scheduler requires a system cron job. Run sudo crontab -e
and add:
* * * * * cd /var/www/snapencode && php artisan schedule:run >> /dev/null 2>&1
Phase 3: Activation (Manual)
1. Login to Your Application
Default Admin Credentials
Navigate to https://your-domain.com/login
and use the credentials created by the database seeder:
Email: [email protected]
Password: snapencode
⚠️ Change these credentials immediately after first login!
2. Verify Your License
Once logged in, you will be prompted to enter your Snapencode Purchase Code. This will activate your application and unlock all features, including Live Streaming.
3. Enable Live Streaming Server
Create a systemd service for the live media server:
sudo nano /etc/systemd/system/snapencode-live.service
Paste the following configuration:
[Unit]
Description=SnapEncode Live Media Server
After=network.target mysql.service redis.service
[Service]
Type=simple
User=www-data
Group=www-data
WorkingDirectory=/var/www/snapencode
ExecStart=/var/www/snapencode/bin/media-live start --api-port="8888" --live-media-dir="/var/www/snapencode/storage/app/public/live_media"
Restart=always
RestartSec=5
StandardOutput=journal
StandardError=journal
SyslogIdentifier=snapencode-live
# Resource limits
LimitNOFILE=65536
LimitNPROC=32768
[Install]
WantedBy=multi-user.target
Enable and start the service:
sudo systemctl daemon-reload
sudo systemctl enable snapencode-live.service
sudo systemctl start snapencode-live.service
Verify the service status:
sudo systemctl status snapencode-live.service
View live logs:
sudo journalctl -u snapencode-live -f
4. Final System Health Check
Verify all components are running correctly:
# Check Nginx
sudo systemctl status nginx
# Check PHP-FPM
sudo systemctl status php8.2-fpm
# Check MariaDB
sudo systemctl status mariadb
# Check Redis
sudo systemctl status redis-server
# Check Supervisor workers
sudo supervisorctl status
# Check Live Media Server
sudo systemctl status snapencode-live
# Test database connection
php /var/www/snapencode/artisan tinker --execute="DB::connection()->getPdo();"
Installation Complete!
Your SnapEncode platform is now fully installed and operational. Here are your next steps:
Immediate Security Tasks
- Change default admin credentials immediately
- Update your
.env
file with strong, unique passwords - Enable firewall if not already configured
- Set up SSL certificates for production use
Performance Optimization
- Monitor system resources during video processing
- Adjust queue worker count based on server capacity
- Configure CDN for video delivery (recommended)
- Set up regular backups of database and uploaded content
Troubleshooting
Common Issues & Solutions:
Queue Workers Not Processing Jobs:
# Manual installation
sudo supervisorctl restart snapencode-worker:*
# Docker installation
docker-compose restart queue
Large File Upload Errors (413):
- Verify PHP upload limits in
/etc/php/8.2/fpm/conf.d/99-uploads.ini
- Check Nginx
client_max_body_size
setting - Restart both PHP-FPM and Nginx services
Live Streaming Not Working:
# Check if ports are open
sudo ufw status
netstat -tlnp | grep :1935
netstat -tlnp | grep :8888
# Verify media server is running
# Manual: sudo systemctl status snapencode-live
# Docker: docker-compose exec queue supervisorctl status snapencode-live
Database Connection Errors:
# Test database connection
php artisan tinker --execute="DB::connection()->getPdo();"
# Check database service status
# Manual: sudo systemctl status mariadb
# Docker: docker-compose exec db mysqladmin ping -h localhost
Support Resources
- Documentation: Check our knowledge base for detailed configuration guides
- Community: Join our Discord server for community support
- Professional Support: Contact us for priority technical assistance
Your SnapEncode video platform is ready for configuration and use. Access the admin panel to customize your platform settings, upload policies, and streaming configurations.