如何在 Nginx 服务器上使用 Drupal 8?

How to use Drupal 8 with a Nginx server?

我刚刚将我的 Drupal 8 站点从 Apache 服务器迁移到 Nginx。

我应用了以下配置:

https://www.nginx.com/resources/wiki/start/topics/recipes/drupal/

我不明白这个块是干什么用的。我应该输入我的服务器的 IP 地址而不是这个吗?

# Very rarely should these ever be accessed outside of your lan
location ~* \.(txt|log)$ {
    allow 192.168.0.0/16;
    deny all;
}

只有在可通过 Web 服务器访问的目录中有 .txt.log 文件时,该规则才有用。

如果是这样,出于安全原因,您应该列出可以访问这些文件的所有 IP 地址。所有其他地址将被禁止。

但是,您不太可能希望通过 http 提供日志文件,因此您可以拒绝所有。

nginx 文档中的更多信息:

http://nginx.org/en/docs/http/ngx_http_access_module.html