为 Varnish 安装 VMOD basic-auth

install VMOD basic-auth for Varnish

我正在尝试安装名为 basicauth 的 VMOD。

这是回购协议:https://git.gnu.org.ua/vmod-basicauth.git

还有一个 README 文件可以帮助指导您完成整个过程。

它告诉你提取代码,还提取 varnish 的代码(在 sudo apt-get source varnish 的帮助下完成的)...我做到了,到目前为止一切顺利。

但是我应该这样做:


run:

  ./configure --with-varnish-source=/usr/src/varnish-3.0.1 --with-vmod-dir

问题

我一直在试图弄清楚在哪里可以找到“配置”脚本。我不知道在哪里可以找到它。

当我查看其他教程时,例如 this one,我猜它应该在 vmod-basicauth 文件夹中......但它不是。只有configure.ac。它尝试 运行 那个文件,但那不起作用。 你们有人知道我如何安装这个 VMOD 吗?任何提示或帮助将不胜感激。

此外:似乎只有非常古老的教程和存储库中的信息...知道我可以从哪里获得更多最新信息吗?

更新

我也下载了“The Varnish Book" now, checked on how to isntall "libvmod-example”。在该文件夹中有一个创建“配置”文件的“autogen.sh”文件。但我在 basicauth 包中也找不到任何“autogen.sh”... 哈哈 ..... arrrrrrr 我一事无成。

有谁知道在哪里可以找到好的教程? 我目前正在使用 ubuntu-server。注意到 redhad 在他们的回购协议中有 VMOD,但这对我没有帮助 ;)

系统信息

以下是关于我的系统的更多信息:

 dpkg -l | grep varnish
ii  libvarnishapi-dev:amd64              6.2.1-2                                     amd64        development files for Varnish
ii  libvarnishapi2:amd64                 6.2.1-2                                     amd64        shared libraries for Varnish
rc  varnish                              6.2.1-2                                     amd64        state of the art, high-performance web accelerator

Serverifno(本例中为本地开发 VM):

最好的, AuthenticPinguin

刚刚测试了一下,编译VMOD没有遇到任何问题。

这是有关如何安装它的分步指南。

1。获取最近的 Varnish 版本

我不确定你是否通过 Ubuntu 包安装了 Varnish,但我建议你通过官方包安装它:https://packagecloud.io/varnishcache/.

2。安装构建依赖项

使用以下命令安装所需的构建依赖项:

apt-get install -y varnish-dev autoconf automake gcc libtool make python3-docutils git

这些依赖项中的大多数都是微不足道的,但是除非您使用官方 Varnish 包存储库,否则可能找不到一个特定的包。这是 varnish-dev.

我已经尝试在 Ubuntu Focal 存储库中本地查找它,我找到的最接近的是 libvarnishapi-dev,但这并没有真正起作用。

That's why I advise using the official packages from https://packagecloud.io/varnishcache/. The version I prefer is https://packagecloud.io/varnishcache/varnish60lts, because it's the LTS version.

3。获取源代码

一旦您设置好所有依赖项,您就可以通过运行执行以下命令继续下载 VMOD 源代码:

cd /usr/src/
git clone git://git.gnu.org.ua/vmod-basicauth.git

如您所见,代码将放在 /usr/src 目录中。

4。编译代码

现在源代码已在您的系统上,您可以运行以下命令来配置、编译和安装 VMOD 代码:

./bootstrap
./configure
make
make install

If ./configure cannot be found, it means it wasn't properly generated by the ./bootstrap command. If that happens, have a look at the output of your ./bootstrap command to figure out what went wrong.

5。导入 VMOD

VMOD 已经安装在正确的位置,所以是时候将它导入您的 VCL 文件并使用它的功能了。

这是一个 VCL 示例:

vcl 4.1;

import basicauth;

sub vcl_recv {
    if (!basicauth.match("/var/www/.htpasswd",req.http.Authorization)) {
        return(synth(401,"Authentication required"));
    }
}