我已经有一段时间没用过 PostfixAdmin 了。最近我访问时,mail.domain.com/postfixadmin
收到一条消息,告诉我将别名指向/postfixadmin/public
。在网上搜索了一番后,我将 Nginx 配置更改为:
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;
}
}
现在我尝试访问 PostfixAdmin 时收到 403 Forbidden 错误。我猜我的配置哪里错了?