I haven't used PostfixAdmin in a while. When I recently went to mail.domain.com/postfixadmin
I was greeted with a message telling me to point an alias to /postfixadmin/public
. After a bit of searching online, this is what I changed my Nginx configuration to:
server {
if ($host = mail.domain.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name mail.domain.com;
include snippets/letsencrypt.conf;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name mail.domain.com;
root /var/www;
ssl_certificate /etc/letsencrypt/live/domain.com-0002/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/domain.com-0002/privkey.pem; # managed by Certbot
ssl_trusted_certificate /etc/letsencrypt/live/domain.com/chain.pem;
include snippets/ssl.conf;
include snippets/letsencrypt.conf;
location / {
try_files $uri $uri/ /index.php;
}
location /postfixadmin {
alias /var/www/postfixadmin/public;
try_files $uri $uri/ /index.php;
}
location /rspamd {
proxy_pass http://127.0.0.1:11334;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ~* \.php$ {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {return 404;}
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name;
}
}
Now I get an 403 Forbidden error trying to access PostfixAdmin. I assume my configuration is wrong somewhere?