server {
listen 80;
listen 443 ssl http2;
server_name dbsmail.deckplatesolutions.com;
# CRITICAL: Set the correct document root (MailWizz install path)
root /var/www/dbsmail.deckplatesolutions.com;
index index.php index.html index.htm;
# SSL (adjust/remove if handled by Plesk/Certbot/etc.)
# ssl_certificate /etc/letsencrypt/live/dbsmail.deckplatesolutions.com/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/dbsmail.deckplatesolutions.com/privkey.pem;
# include /etc/letsencrypt/options-ssl-nginx.conf;
# ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
# ============================================================
# CRITICAL: MAILWIZZ ROUTING / REWRITE BLOCK
# ============================================================
# Frontend (root)
location / {
try_files $uri $uri/ /index.php?$args;
}
# Customer area
location /customer {
index index.php;
try_files $uri $uri/ /customer/index.php?$args;
}
# Backend area
location /backend {
index index.php;
try_files $uri $uri/ /backend/index.php?$args;
}
# API
location /api {
index index.php;
try_files $uri $uri/ /api/index.php?$args;
}
# ============================================================
# PHP EXECUTION BLOCK (PHP-FPM 8.3 via socket)
# ============================================================
location ~ \.php$ {
# Only serve existing PHP files
try_files $uri =404;
# PHP-FPM socket (adjust version/path if needed)
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
# Split PATH_INFO (not strictly required, but safe for frameworks)
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_index index.php;
# Timeouts (MailWizz can run heavy jobs)
fastcgi_read_timeout 600s;
fastcgi_send_timeout 600s;
}
# Deny access to hidden files (.htaccess, etc.)
location ~ /\.ht {
deny all;
}
}