Varnish

Varnish 無法啟動。執行 VCC 編譯器失敗,沒有編譯器錯誤

  • August 21, 2019

編輯:系統磁碟空間不足,因此編譯器無法創建文件。varnishd 的輸出並沒有告訴你這一點。

如果您遇到沒有明顯原因的奇怪錯誤,請務必檢查您的磁碟配額:)

6小時後會回答自己。

我正在執行由主管控制的清漆。

Varnish 執行緩慢,當我使用 supervisor 重新啟動 varnish 時沒有進行任何更改。

但是重啟失敗,手動執行後 sbin/varnishd -F -f etc/varnish/ourconfig.vcl -a localhost -p thread_pool_min=10 -p thread_pool_max=50 -s malloc,250M

我收到以下錯誤

執行 VCC 編譯器失敗,退出 1

VCL 編譯失敗

而已。

這是我們的 vcl 文件:

backend default {
   .host = "127.0.0.1";
   .port = "8002";
   .first_byte_timeout = 300s;
}

sub vcl_recv {
    if (req.request == "BAN") {
       ban("obj.http.X-Keywords ~ " + req.http.X-Ban-Keywords);
    }

    if (req.request != "GET" && req.request != "HEAD") {
       return (pass);
    }

    // Remove has_js and Google Analytics __* cookies.
    set req.http.Cookie = regsuball(req.http.Cookie, "(^|;\s*)(__(ut|at)[a-z]+|has_js)=[^;]*", "");
    // Remove a ";" prefix, if present.
    set req.http.Cookie = regsub(req.http.Cookie, "^;\s*", "");

    set req.grace = 5m;

    if (req.url ~".*(jpg|gif|kss|css|js|png|svg|woff)$") {
       unset req.http.Authorization;
       unset req.http.Cookie;
    }

    if (req.http.Authorization || req.http.Cookie ~ "__ac") {
        return (pass);
    }

    return (lookup);
}

sub vcl_fetch {

 if (req.url ~".*(jpg|gif|kss|css|js|png|svg|woff)$") {
   set beresp.ttl = 86400s;
 }

 if (req.url ~ "/login_form$" || req.http.Cookie ~ "__ac") {
     return (hit_for_pass);
 }
 set beresp.grace = 5m;
 unset beresp.http.Set-Cookie;
 unset beresp.http.Pragma;
 unset beresp.http.Cache-Control;

 if (beresp.ttl < 15m) {
     set beresp.ttl = 15m;
 }

 # images should live one day
 if (req.url ~ "\/(image|image_thumb|image_mini|cover_image|image_small|image_preview)$") {
     set beresp.ttl = 1209600s;
     set beresp.http.cache-control = "max-age=1209600;s-maxage=1209600";
     set beresp.http.max-age = "1209600";
     set beresp.http.s-maxage = "1209600";
     set beresp.http.expires = "1209600";
 }
 if (req.url ~ "\.(png|gif|jpg|swf|otf|ttf|woff|svg)$") {
     set beresp.ttl = 1209600s;
     set beresp.http.cache-control = "max-age=1209600;s-maxage=1209600";
     set beresp.http.max-age = "1209600";
     set beresp.http.s-maxage = "1209600";
     set beresp.http.expires = "1209600";
 }
 # resource files should live 14 days to make google happy
 if (req.url ~ "\.(css|js|kss)$") {
     set beresp.ttl = 1209600s;
     set beresp.http.cache-control = "max-age=1209600;s-maxage=1209600";
     set beresp.http.max-age = "1209600";
     set beresp.http.s-maxage = "1209600";
     set beresp.http.expires = "1209600";
 }

 if (beresp.status >= 500 || beresp.status == 403 || beresp.status == 302) {
     set beresp.ttl = 0s;
 }

 return (deliver);
}

sub vcl_deliver {
 set resp.http.X-Hits = obj.hits;
}

任何幫助,將不勝感激。非常感謝!

只是為了將其註冊為答案,OP發現解決方案是;

不,問題是磁碟已滿。所以沒有空間來編譯文件。清理後一切正常。這也是減速的原因,傻瓜。:) 無論如何感謝您的建議!–

引用自:https://serverfault.com/questions/489296