首页 > 编程语言 >varnish源码编译以及简单配置

varnish源码编译以及简单配置

时间:2024-05-12 21:19:00浏览次数:18  
标签:varnish libtoolize m4 编译 源码 usr install 7.5

varnish安装

系统centos7

ip 192.168.40.131

禁止透明大页
echo never > /sys/kernel/mm/transparent_hugepage/enabled 

减少最大堆栈大小
ulimit -s 256


安装nginx
yum list | grep ^nginx && yum -y install nginx*

mkdir /usr/share/nginx/html/hello
echo “hello world” > /usr/share/nginx/hello/index.html
systemctl start nginx

http://192.168.40.131/hello/


源码编译
wget https://varnish-cache.org/downloads/varnish-7.5.0.tgz
https://varnish-cache.org/docs/7.5/installation/install_source.html

tar -zxvf varnish-7.5.0.tgz

[root@racknerd-5cad50 ~]# cd varnish-7.5.0
[root@racknerd-5cad50 varnish-7.5.0]# ls
aclocal.m4  config.h.in   etc      m4                README.rst                    varnish.m4
autogen.sh  configure     include  Makefile.am       tools                         vmod
bin         configure.ac  INSTALL  Makefile.in       varnishapi.pc.in              vsc.am
build-aux   contrib       lib      man               varnishapi-uninstalled.pc.in  vtc.am
ChangeLog   doc           LICENSE  README.Packaging  varnish-legacy.m4             wflags.py

在 Red Hat / CentOS 8 上,sphinx 不包含在默认存储库中,因此请执行以下步骤以将其从 powertools 存储库中包含:
yum install -y python-sphinx
完成所需软件包的安装
yum install -y \
make \
autoconf \
automake \
jemalloc-devel \
libedit-devel \
libtool \
libunwind-devel \
ncurses-devel \
pcre2-devel \
pkgconfig \
python3-docutils \
cpio

重建 svg 文件:      
yum install graphviz -y
从存储库中提取
yum install git -y


cd varnish-cache
sh autogen.sh
libtoolize: `build-aux/ltmain.sh' is newer: use `--force' to overwrite
libtoolize: `m4/libtool.m4' is newer: use `--force' to overwrite
libtoolize: `m4/ltoptions.m4' is newer: use `--force' to overwrite
libtoolize: `m4/ltversion.m4' is newer: use `--force' to overwrite

[root@host2 varnish-7.5.0]# autoreconf -fi
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.
libtoolize: copying file `build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'


[root@host2 varnish-7.5.0]# sh autogen.sh 
[root@host2 varnish-7.5.0]# sh configure



make      check
Testsuite summary for Varnish 7.5.0
============================================================================
# TOTAL: 1
# PASS:  0
# SKIP:  1
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
==========================================


sudo make install

/bin/sh /root/varnish-7.5.0/build-aux/install-sh -d -m 0755 /usr/local/var/varnish
/usr/bin/mkdir -p '/usr/local/share/aclocal'
/usr/bin/install -c -m 644 varnish.m4 varnish-legacy.m4 '/usr/local/share/aclocal'
/usr/bin/mkdir -p '/usr/local/lib/pkgconfig'
/usr/bin/install -c -m 644 varnishapi.pc '/usr/local/lib/pkgconfig'


[root@host2 bin]# which varnishd
/usr/local/sbin/varnishd

配置文件
cp -r ./share/doc/varnish/example.vcl  /etc/varnish/default.vcl

mkdir /etc/varnish
uuidgen > /etc/varnish/secret

cat /etc/varnish/default.vcl
# Default backend definition. Set this to point to your content server.
backend default {
    .host = "192.168.40.131";
    .port = "80";
}
启动
varnishd -f /etc/varnish/default.vcl -s malloc,1G -T 127.0.0.1:20000 -a 0.0.0.0:8080 -p thread_pool_min=50 -p thread_pool_max=1000 -P  /var/log/varnish.pid

启动2
varnishd -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,1G -T 127.0.0.1:20000 -a 0.0.0.0:8080 -p thread_pool_min=50 -p thread_pool_max=1000 -P  /var/log/varnish.pid
启动参数
-s:指定使用内存进行缓存,内存大小1G
-T:指定管理IP和端口
-a:指定访问IP和端口
-p:指定单个pool打开的最小thread和最大thread(pool数一般与CPU核数一致)
-P:pid进程文件

访问:
http://192.168.40.131:8080/hello/


查看日志
# varnishncsa
192.168.40.1 - - [12/May/2024:14:04:12 +0800] "GET http://192.168.40.131:8080/hello/ HTTP/1.1" 200 18 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36"
192.168.40.1 - - [12/May/2024:14:04:12 +0800] "GET http://192.168.40.131:8080/favicon.ico HTTP/1.1" 404 3650 "http://192.168.40.131:8080/hello/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36"

 

   

标签:varnish,libtoolize,m4,编译,源码,usr,install,7.5
From: https://www.cnblogs.com/lzjloveit/p/18188206

相关文章

  • 如何编译Godot(Godot & Godot with C#)
    要在Windows下编译Godot,需要以下环境:VisualStudioCommunity:使用最新版本。MinGW-w64:可以替代VisualStudio。请务必将其安装/配置为使用posix线程模型。使用MinGW编译主分支时,需要GCC9或更高版本。Python3.6+:确保在安装程序中启用将Python添加到环境变量......
  • 代码(CODE)到二进制(BIN)文件的编译过程
    这些步骤将源代码转换成可以在目标硬件上执行的机器代码。以下是这个过程的一般描述:预处理(Preprocessing):源代码(如.c、.cpp、.s等)首先被预处理。预处理器处理源文件中的宏定义、条件编译指令、包含指令(如#include)等。预处理器的输出通常是一个.i或.ii文件,它包含了所有宏替......
  • autoit au3 IT管理员使用指南(一)基础安装、测试、编译
    简介AutoIt是一款完全免费的Windows自动化工具,支持各种Windows操作系统,可以用于自动运行基于GUI和非GUI程序,与系统进行交互,以及创建自定义的GUI窗体,完成各种自动化任务。对我们IT管理员来说,什么办公自动化就算了,我们用的最多的其实是安装软件。曾到处收集软件安装时的静默......
  • JUC源码解析:深入理解 volatile
    JUC源码解析:深入理解volatilevolatile的定义volatile的作用:保证可见性禁止指令重排序volatile可以被看作是轻量版的synchronized,volatile保证了多线程中共享变量的“可见性”,就是说,当volatile变量的值被修改时,其他线程能读取到被修改的变量值。如果volatile使用恰......
  • [附源码]新天龙八部3永恒经典之江山策仿官方_联网+单机搭建架设教程
    新天龙八部3永恒经典之江山策仿官_联网架设搭建_附赠GM工具+视频教程本教程仅限学习使用,禁止商用,一切后果与本人无关,此声明具有法律效应!!!!教程是本人亲自搭建成功的,绝对是完整可运行的,踩过的坑都给你们填上了。如果你是小白也没问题,跟着教程走也是可以搭建成功的,但是一定要有耐心......
  • centos7.9编译安装greenplum6.20
    一、下载安装包上传到服务器的/opt/soft下https://github.com/greenplum-db/gpdb/archive/refs/tags/6.20.0.tar.gz二、创建用户useraddgpadmin#检查家目录是否创建passwdgpadmingpadmingpadmin三、安装依赖GreenplumDatabase编译和运行依赖于各种系统库和Python......
  • JVM类加载器ClassLoader源码剖析
    在JVM类加载器分类中通过ClassLoader获取了不同类型的类加载器,它是如此之重要那么ClassLoader究竟为何物呢?通过源码分析(以jdk17示例):调试跟踪ClassLoader:......
  • qgroundcontrol开发环境搭建源码编译
    qgroundcontrol是一款无人机地面站开源软件,C++/QT开发在https://github.com/mavlink/qgroundcontrol上就能找到,选择稳定版下载最新的是2.6下载https://github.com/mavlink/qgroundcontrol/archive/Stable_V2.6.zipQT的对应版本http://download.qt-project.org/official_releas......
  • SciTech-BigDataAIML-TensorFlow-Model的编译:设置(LossFunction+Optimizer+Metrics)与
    机器学习|model.compile()用法model.compile()的作用:为经过设计的Model(神经网络模型)设置好:loss损失函数、optimizer优化器、metrics准确性评价函数。并且进行编译;Optimizers优化器:Optimizer的主要功能是作用在GD(梯度下降)的过程,使得Gradient(梯度)更快(快速......
  • linux环境静态编译openssl、curl
    编译opensslopenssl下载地址:https://www.openssl.org/source/index.htmltarzxvfopenssl-3.3.0.tar.gzcdopenssl-3.3.0/./config-fPICno-shared--prefix=/root/openssl_install--openssldir=/root/openssl_installmakemakeinstall编译curlcurl下载地址:https:/......