add update nginx config to domain and create production setup docker

This commit is contained in:
2025-06-11 19:02:02 +07:00
parent 647aa51187
commit 0b211915f1
13 changed files with 1899 additions and 74 deletions

View File

@@ -1,42 +1,46 @@
APP_NAME="CKB Application"
APP_ENV=local
APP_NAME="CKB Bengkel System"
APP_ENV=production
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost:8000
APP_DEBUG=false
APP_URL=https://bengkel.digitaloasis.xyz
LOG_CHANNEL=stack
LOG_LEVEL=debug
LOG_LEVEL=error
# Database Configuration for Docker
# Database Configuration for Production
DB_CONNECTION=mysql
DB_HOST=db
DB_PORT=3306
DB_DATABASE=ckb_db
DB_USERNAME=root
DB_PASSWORD=root
DB_DATABASE=ckb_production
DB_USERNAME=ckb_user
DB_PASSWORD=secure_password_here
DB_ROOT_PASSWORD=secure_root_password_here
# Redis Configuration for Docker
# Redis Configuration for Production
REDIS_HOST=redis
REDIS_PASSWORD=null
REDIS_PASSWORD=secure_redis_password
REDIS_PORT=6379
BROADCAST_DRIVER=log
BROADCAST_DRIVER=redis
CACHE_DRIVER=redis
FILESYSTEM_DRIVER=local
QUEUE_CONNECTION=sync
QUEUE_CONNECTION=redis
SESSION_DRIVER=redis
SESSION_LIFETIME=120
# Mail Configuration for Docker (MailHog)
# Mail Configuration for Production
MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=test@ckb.local
MAIL_HOST=your-smtp-host.com
MAIL_PORT=587
MAIL_USERNAME=your-email@domain.com
MAIL_PASSWORD=your-email-password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=noreply@bengkel.digitaloasis.xyz
MAIL_FROM_NAME="${APP_NAME}"
# Trusted Proxies for Production
TRUSTED_PROXIES=*
# AWS (if needed for production)
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=

64
docker/env.example.local Normal file
View File

@@ -0,0 +1,64 @@
APP_NAME="CKB Application"
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost:8000
LOG_CHANNEL=stack
LOG_LEVEL=debug
# Database Configuration for Local Development
DB_CONNECTION=mysql
DB_HOST=db
DB_PORT=3306
DB_DATABASE=ckb_db
DB_USERNAME=root
DB_PASSWORD=root
# Redis Configuration for Local Development
REDIS_HOST=redis
REDIS_PASSWORD=null
REDIS_PORT=6379
BROADCAST_DRIVER=log
CACHE_DRIVER=redis
FILESYSTEM_DRIVER=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=redis
SESSION_LIFETIME=120
# Mail Configuration for Local Development (MailHog)
MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=test@ckb.local
MAIL_FROM_NAME="${APP_NAME}"
# AWS (for local testing if needed)
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
# Pusher (for local testing if needed)
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_HOST=
PUSHER_PORT=443
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=mt1
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
# Local Development Settings
TELESCOPE_ENABLED=true
DEBUGBAR_ENABLED=true

View File

@@ -0,0 +1,78 @@
APP_NAME="CKB Bengkel System"
APP_ENV=production
APP_KEY=
APP_DEBUG=false
APP_URL=https://bengkel.digitaloasis.xyz
LOG_CHANNEL=stack
LOG_LEVEL=error
# Database Configuration for Production
# IMPORTANT: Change these credentials for security!
DB_CONNECTION=mysql
DB_HOST=db
DB_PORT=3306
DB_DATABASE=ckb_production
DB_USERNAME=ckb_user
DB_PASSWORD=CHANGE_THIS_SECURE_PASSWORD
DB_ROOT_PASSWORD=CHANGE_THIS_ROOT_PASSWORD
# Redis Configuration for Production
REDIS_HOST=redis
REDIS_PASSWORD=CHANGE_THIS_REDIS_PASSWORD
REDIS_PORT=6379
BROADCAST_DRIVER=redis
CACHE_DRIVER=redis
FILESYSTEM_DRIVER=local
QUEUE_CONNECTION=redis
SESSION_DRIVER=redis
SESSION_LIFETIME=120
# Mail Configuration for Production
# Configure with your SMTP provider (Gmail, SendGrid, Mailgun, etc.)
MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=your-email@gmail.com
MAIL_PASSWORD=your-app-password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=noreply@bengkel.digitaloasis.xyz
MAIL_FROM_NAME="${APP_NAME}"
# Trusted Proxies for Production (Nginx reverse proxy)
TRUSTED_PROXIES=*
# AWS Configuration for Production (if using S3 for file storage)
AWS_ACCESS_KEY_ID=your-aws-access-key
AWS_SECRET_ACCESS_KEY=your-aws-secret-key
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=ckb-production-storage
AWS_USE_PATH_STYLE_ENDPOINT=false
# Pusher Configuration for Production (if using real-time features)
PUSHER_APP_ID=your-pusher-app-id
PUSHER_APP_KEY=your-pusher-key
PUSHER_APP_SECRET=your-pusher-secret
PUSHER_HOST=
PUSHER_PORT=443
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=ap1
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
# Production Optimization Settings
TELESCOPE_ENABLED=false
DEBUGBAR_ENABLED=false
# Security Settings
SESSION_SECURE_COOKIE=true
SESSION_SAME_SITE=strict
# Backup Configuration (optional)
BACKUP_DISK=s3
BACKUP_NOTIFICATION_MAIL=admin@digitaloasis.xyz

142
docker/nginx-proxy.conf Normal file
View File

@@ -0,0 +1,142 @@
events {
worker_connections 1024;
}
http {
# Basic settings
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
client_max_body_size 100M;
# Gzip compression
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_types
text/plain
text/css
text/xml
text/javascript
application/javascript
application/xml+rss
application/json
image/svg+xml;
# MIME types
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Logging
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log;
# Rate limiting
limit_req_zone $binary_remote_addr zone=login:10m rate=10r/m;
limit_req_zone $binary_remote_addr zone=api:10m rate=60r/m;
# Upstream to Laravel app
upstream app {
server app:80;
}
# HTTP to HTTPS redirect
server {
listen 80;
server_name bengkel.digitaloasis.xyz www.bengkel.digitaloasis.xyz;
# Let's Encrypt challenge
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
# Redirect all other traffic to HTTPS
location / {
return 301 https://$server_name$request_uri;
}
}
# HTTPS server configuration
server {
listen 443 ssl http2;
server_name bengkel.digitaloasis.xyz www.bengkel.digitaloasis.xyz;
# SSL configuration
ssl_certificate /etc/nginx/ssl/fullchain.pem;
ssl_certificate_key /etc/nginx/ssl/privkey.pem;
# Modern SSL configuration
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384;
ssl_prefer_server_ciphers off;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
# Security headers
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
# Root directory
root /var/www/html/public;
index index.php index.html;
# Proxy settings
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;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Forwarded-Port $server_port;
# Handle static files
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
proxy_pass http://app;
expires 1y;
add_header Cache-Control "public, immutable";
}
# Rate limiting for login endpoints
location ~ ^/(login|register|password) {
limit_req zone=login burst=5 nodelay;
proxy_pass http://app;
}
# Rate limiting for API endpoints
location /api/ {
limit_req zone=api burst=20 nodelay;
proxy_pass http://app;
}
# Main application
location / {
proxy_pass http://app;
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_send_timeout 300;
}
# Health check endpoint
location /health {
access_log off;
proxy_pass http://app;
}
# Block access to sensitive files
location ~ /\. {
deny all;
}
location ~ ^/(storage|bootstrap/cache) {
deny all;
}
}
}