-
Notifications
You must be signed in to change notification settings - Fork 0
Self Hosting Guide
github-actions[bot] edited this page Feb 3, 2026
·
1 revision
Complete guide to running your own instance of PayUs-as-a-Service.
🔗 Related: Getting Started | Troubleshooting | Contributing
- Privacy: Keep all data on your own servers
- Customization: Add your own messages and tones
- No Rate Limits: Control your own rate limiting
- Reliability: Don't depend on external services
Choose one of the following:
- Docker 20.10+
- Docker Compose 2.0+
- 1GB RAM
- 5GB disk space
- PHP 8.3+
- Composer 2.x
- MySQL 8.0+ or PostgreSQL 13+ (SQLite also supported)
- Nginx or Apache (optional)
git clone https://github.com/sticknologic/payus-as-a-service.git
cd payus-as-a-serviceCopy the example environment files:
cp .env.example .env
cp sample.env.db .env.dbEdit .env and configure these key variables:
APP_NAME="PayUs-as-a-Service"
APP_ENV=production
APP_DEBUG=false
APP_URL=https://your-domain.com
DB_CONNECTION=mysql
DB_HOST=mysql_puaas
DB_PORT=3306
DB_DATABASE=db_puaas
DB_USERNAME=sticknologic
DB_PASSWORD=your_secure_passworddocker compose build
docker compose up -ddocker compose run --rm app composer install --no-dev --optimize-autoloaderdocker compose run --rm app php artisan key:generatedocker compose run --rm app php artisan migrate --force
docker compose run --rm app php artisan db:seed --forcedocker compose run --rm app php artisan config:cache
docker compose run --rm app php artisan route:cache
docker compose run --rm app php artisan view:cacheYour API is now running at:
- API: http://localhost:9006
- Docs: http://localhost:9006/docs
git clone https://github.com/sticknologic/payus-as-a-service.git
cd payus-as-a-service
composer install --no-dev --optimize-autoloadercp .env.example .env
php artisan key:generateEdit .env:
APP_ENV=production
APP_DEBUG=false
APP_URL=https://your-domain.com
# For SQLite (simplest)
DB_CONNECTION=sqlite
DB_DATABASE=/absolute/path/to/database.sqlite
# Or for MySQL
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=payus_db
DB_USERNAME=your_username
DB_PASSWORD=your_passwordFor SQLite:
touch database/database.sqliteFor MySQL, create the database first, then run:
php artisan migrate --force
php artisan db:seed --forceserver {
listen 80;
server_name api.yourdomain.com;
root /path/to/payus-as-a-service/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.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}<VirtualHost *:80>
ServerName api.yourdomain.com
DocumentRoot /path/to/payus-as-a-service/public
<Directory /path/to/payus-as-a-service/public>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>chmod -R 755 storage bootstrap/cache
chown -R www-data:www-data storage bootstrap/cachephp artisan config:cache
php artisan route:cache
php artisan view:cacheapi.yourdomain.com {
reverse_proxy localhost:9006
}
server {
listen 80;
server_name api.yourdomain.com;
location / {
proxy_pass http://localhost:9006;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}Messages are stored in messages.json. To add your own:
- Edit
messages.json - Add messages under the appropriate tone
- Re-seed the database:
php artisan migrate:fresh --seed --forceEdit app/Providers/AppServiceProvider.php:
RateLimiter::for('api', fn (Request $request) =>
Limit::perMinute(120)->by($request->ip()) // Changed from 60 to 120
);Then clear cache:
php artisan config:clear- Add to
app/Enums/MessageTone.php - Add messages to
messages.json - Update database:
php artisan migrate:fresh --seed --forcegit pull origin main
docker compose down
docker compose build
docker compose up -d
docker compose run --rm app composer install --no-dev
docker compose run --rm app php artisan migrate --force
docker compose run --rm app php artisan optimize# Docker
docker compose logs -f app
# Manual
tail -f storage/logs/laravel.log# MySQL (Docker)
docker compose exec mysql_puaas mysqldump -u root -p db_puaas > backup.sql
# SQLite
cp database/database.sqlite database/database.backup.sqliteSee the Troubleshooting Guide for common issues and solutions.
- Always use HTTPS in production
- Keep dependencies updated
- Use strong database passwords
- Regularly backup your data
- Monitor logs for suspicious activity
- Consider adding authentication for your instance