This guide walks you through deploying Discord Webhook Manager on Ubuntu 22.04 or 24.04 LTS.
Prerequisites
Before starting, ensure you have:
- Ubuntu 22.04 or 24.04 LTS server
- Root or sudo access
- Domain name pointing to your server (for production)
- All system requirements met
Installation Steps
1. Install System Dependencies
Update system packages
sudo apt update
sudo apt upgrade -y
Install basic utilities
sudo apt install -y git curl unzip zip software-properties-common
Install PHP 8.2+ and extensions
# Add PHP repository
sudo add-apt-repository ppa:ondrej/php -y
sudo apt update
# Install PHP 8.2 and required extensions
sudo apt install -y php8.2-fpm php8.2-cli php8.2-common \
php8.2-bcmath php8.2-curl php8.2-mbstring php8.2-xml \
php8.2-zip php8.2-pgsql php8.2-redis php8.2-gd
# Verify installation
php -v
Replace php8.2 with php8.4 if you prefer the latest version (as referenced in README).
Install Composer
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
sudo chmod +x /usr/local/bin/composer
# Verify installation
composer --version
Install Node.js 20+
# Install Node.js 20 LTS
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs
# Verify installation
node --version
npm --version
Install PostgreSQL
# Install PostgreSQL 14+
sudo apt install -y postgresql postgresql-contrib
# Start and enable PostgreSQL
sudo systemctl start postgresql
sudo systemctl enable postgresql
# Verify installation
psql --version
Install Redis
# Install Redis
sudo apt install -y redis-server
# Start and enable Redis
sudo systemctl start redis-server
sudo systemctl enable redis-server
# Verify Redis is running
redis-cli ping
# Should respond: PONG
Install Nginx
sudo apt install -y nginx
# Start and enable Nginx
sudo systemctl start nginx
sudo systemctl enable nginx
Install Supervisor
sudo apt install -y supervisor
# Start and enable Supervisor
sudo systemctl start supervisor
sudo systemctl enable supervisor
Create PostgreSQL database and user
# Access PostgreSQL as postgres user
sudo -u postgres psql
-- Create database
CREATE DATABASE discord_webhook;
-- Create user with password
CREATE USER webhook_user WITH PASSWORD 'your_secure_password';
-- Grant privileges
GRANT ALL PRIVILEGES ON DATABASE discord_webhook TO webhook_user;
-- Grant schema privileges
\c discord_webhook
GRANT ALL ON SCHEMA public TO webhook_user;
-- Exit
\q
Replace your_secure_password with a strong, unique password. Never use default credentials in production.
3. Clone and Setup Application
Clone repository
# Create web directory
sudo mkdir -p /var/www
cd /var/www
# Clone the repository
sudo git clone https://github.com/your-username/discord-webhook-manager.git
cd discord-webhook-manager/app
Replace the repository URL with your actual repository location.
Install PHP dependencies
# Install production dependencies
sudo composer install --optimize-autoloader --no-dev
Install Node.js dependencies and build assets
# Install dependencies
sudo npm install
# Build production assets
sudo npm run build
Setup environment file
# Copy example environment file
sudo cp .env.example .env
# Generate application key
sudo php artisan key:generate
Now edit the .env file with your configuration. See Environment Configuration for details.Set permissions
# Set ownership to web server user
sudo chown -R www-data:www-data /var/www/discord-webhook-manager
# Set directory permissions
sudo chmod -R 775 storage bootstrap/cache
Run database migrations
# Run migrations
sudo -u www-data php artisan migrate --force
Optimize Laravel
# Cache configuration
sudo -u www-data php artisan config:cache
# Cache routes
sudo -u www-data php artisan route:cache
# Cache views
sudo -u www-data php artisan view:cache
Create Nginx configuration
sudo nano /etc/nginx/sites-available/discord-webhook-manager
Add the following configuration:server {
listen 80;
listen [::]:80;
server_name yourdomain.com www.yourdomain.com;
root /var/www/discord-webhook-manager/app/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
index index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_hide_header X-Powered-By;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
Replace yourdomain.com with your actual domain and adjust the PHP-FPM socket path if using a different PHP version.
Enable site and restart Nginx
# Create symbolic link
sudo ln -s /etc/nginx/sites-available/discord-webhook-manager /etc/nginx/sites-enabled/
# Test Nginx configuration
sudo nginx -t
# Restart Nginx
sudo systemctl restart nginx
5. Setup SSL Certificate (Production)
For production deployments, use Let’s Encrypt for free SSL certificates:
# Install Certbot
sudo apt install -y certbot python3-certbot-nginx
# Obtain and install certificate
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com
# Test automatic renewal
sudo certbot renew --dry-run
Certbot will automatically configure Nginx to use HTTPS and redirect HTTP traffic.
This step is CRITICAL. Without queue workers and the scheduler, scheduled messages will not be sent.
See the Worker Setup Guide for detailed instructions on configuring Supervisor and cron.
Verification
After deployment, verify everything is working:
Check web server
Visit your domain in a browser. You should see the application login page.
Check Redis connection
cd /var/www/discord-webhook-manager/app
sudo -u www-data php artisan tinker
Check queue workers
sudo supervisorctl status
Workers should show RUNNING status.Check application logs
tail -f /var/www/discord-webhook-manager/app/storage/logs/laravel.log
Check for any errors or warnings.
Post-Deployment
Security Hardening
-
Firewall Configuration:
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
-
Disable unnecessary services
-
Regular security updates:
sudo apt update && sudo apt upgrade -y
Monitoring
Set up monitoring for:
- Application logs:
storage/logs/laravel.log
- Worker logs:
storage/logs/worker.log
- Nginx access/error logs:
/var/log/nginx/
- System resources (CPU, RAM, disk)
Backup Strategy
- Database backups (daily recommended)
- File storage backups (
storage/app/scheduled_messages/)
- Environment file backup (
.env)
Troubleshooting
500 Internal Server Error
# Check PHP-FPM logs
sudo tail -f /var/log/php8.2-fpm.log
# Check Laravel logs
tail -f storage/logs/laravel.log
# Clear all cache
php artisan optimize:clear
Permission Denied Errors
# Reset permissions
sudo chown -R www-data:www-data storage bootstrap/cache
sudo chmod -R 775 storage bootstrap/cache
Database Connection Errors
# Verify PostgreSQL is running
sudo systemctl status postgresql
# Test connection
psql -h 127.0.0.1 -U webhook_user -d discord_webhook
Automated Deployment Script
The repository includes a deployment script (deploy.sh) that automates updates:
sudo /var/www/discord-webhook-manager/deploy.sh
This script:
- Puts the application in maintenance mode
- Pulls latest changes from Git
- Installs dependencies
- Builds assets
- Runs migrations
- Clears and rebuilds cache
- Restarts services
Next Steps