我可以将 403 发送到 nginx 中的主页吗?

Can I send 403 to homepage in nginx?

我已将以下内容放入 .htacess

ErrorDocument 403 /

但我仍然收到来自 nginx 的默认 403 Forbidden 消息。我可以在 nginx 中发送 403 到我的主页吗?

我没有编辑 .htaccess,而是使用以下内容编辑了 /etc/nginx/sites-enabled/default

error_page 403 /index.php;

成功了!