2016-06-06 2 views
2

나는 심포니 내 레즈 플랫폼 CMS.I을 위해 니스를 사용하고 싶습니다 내 광택을 설정하려면이 자습서를 따랐다 : http://book.varnish-software.com/4.0/chapters/Getting_Started.html#exercise-install-varnishSymfony에서 광택이 활성화되었는지 확인하는 방법은 무엇입니까?

그래서 나는 다음과 같은 작업 서버가 :

  • 니스가 수신 대기 8080

  • : 8080

  • 아파치는 로컬 호스트에서 수신 : 포트 (80)는

  • 니스는 로컬 호스트에서 백엔드를 사용 0

기본 ezplatform.yml 및 ezplatform.conf를 설정하여 기본 캐시를 비활성화하고 바니시를 사용 가능하게했습니다. NETSTAT은 니스 서버 나에게 다음 주소를 retreive -nlpt 때문에 나는 니스 서버 IP 주소 0.0.0.0을 넣어

SetEnv USE_HTTP_CACHE 0 
SetEnv TRUSTED_PROXIES "0.0.0.0" 

:

나는 문서 https://doc.ez.no/display/TECHDOC/Using+Varnish를 folling ezplatform.conf하기 위해이 두 라인을 추가
tcp  0  0 0.0.0.0:80    0.0.0.0:*    LISTEN  11151/varnishd  
tcp  0  0 127.0.0.1:1234   0.0.0.0:*    LISTEN  11151/varnishd 

그래서 나는 이것이 올바른 가치라고 생각합니다. 그런 다음, 나는 (위의 문서를 확인) 내 ezplatform.yml에 다음 줄을 추가 : 니스와 아파치가 아니라 다시 시작

ezpublish: 
    http_cache: 
     purge_type: http 
    siteaccess: 
     list: [site] 
     groups: 
      http_cache: 
       purge_servers: 0.0.0.0:80 

. 그런 다음, 니스는 HTTP 헤더를 확인, 현지 웹 사이트에서 사용 된 경우 I 체크, 나는이있어 :

입니다
Via: "1.1 varnish-v4" 
X-Varnish: "32808" 

, 내 생각, 좋은 진행.

Cache Information 
    Default Cache default 
    Available Drivers Apc, BlackHole, FileSystem, Memcache, Redis, SQLite 
    Total Requests 349 
    Total Hits 349 
Cache Service: default 
    Drivers FileSystem 
    Calls 349 
    Hits  349 
    Doctrine Adapter  false 
    Cache In-Memory true 

여전히이를 얻기 위해 정상인가요 : Anyaway는 심포니 프로파일, 나는 여전히 다음과 같은 인텔의이? 기본 캐시와 같지 않아야합니다 : 기본값 대신 바니시? 내 바니쉬가 심포니 기본 캐시 대신 현재 내 사이트에서 작동하는지 어떻게 확인할 수 있습니까?

는, BTW 여기 내 VCL 파일입니다

# 
# This is an example VCL file for Varnish. 
# 
# It does not do anything by default, delegating control to the 
# builtin VCL. The builtin VCL is called when there is no explicit 
# return statement. 
# 
# See the VCL chapters in the Users Guide at https://www.varnish-cache.org/docs/ 
# and https://www.varnish-cache.org/trac/wiki/VCLExamples for more examples. 

# Marker to tell the VCL compiler that this VCL has been adapted to the 
# new 4.0 format. 
vcl 4.0; 
import directors; 

# Default backend definition. Set this to point to your content server. 
backend default { 
    .host = "127.0.0.1"; 
    .port = "8080"; 
} 

sub vcl_init { 
    new backs = directors.hash(); 
    backs.add_backend(default, 1); 
} 

sub vcl_recv { 
    # Happens before we check if we have this in cache already. 
    # 
    # Typically you clean up the request here, removing cookies you don't need, 
    # rewriting the request, etc. 
    set req.http.X-cookie = req.http.cookie; 
    if (!req.http.Cookie ~ "Logged-In") { 
     unset req.http.Cookie; 
    } 
    if (req.url ~ "\.(png|gif|jpg|png|css|js|html)$") { 
     unset req.http.Cookie; 
    } 
} 

sub vcl_backend_response { 
    # Happens after we have read the response headers from the backend. 
    # 
    # Here you clean the response headers, removing silly Set-Cookie headers 
    # and other mistakes your backend does. 
} 

sub vcl_deliver { 
    # Happens when we have all the pieces we need, and are about to send the 
    # response to the client. 
    # 
    # You can do accounting or modifying the final object here. 
} 

가 완료되지 않은 경우에도 심포니의 기본 캐시가 여전히 작동하고 어떻게 구성 파일에 장애인이 있기 때문에, 내가하지 않습니다.

도움 주셔서 감사합니다.

답변

0

당신은

Via: "1.1 varnish-v4" 
X-Varnish: "32808" 

당신의 니스 같은이 작동을 참조합니다. 그래도 symfony 캐시를 비활성화 하시겠습니까? 둘 다 사용할 수 있습니다. 이것은 프로그램 로직에 달려 있습니다.

당신이 다음 줄을 추가 할 수 있습니다 developement에 동안 니스에 더 많은 통찰력을 얻을하려는 경우

:

sub vcl_deliver { 
    if (obj.hits > 0) { # Add debug header to see if it's a HIT/MISS 
    set resp.http.X-Cache = "HIT"; 
    } else { 
    set resp.http.X-Cache = "MISS"; 
    } 
    # show how ofthe the object created a hit so far (reset on miss) 
    set resp.http.X-Cache-Hits = obj.hits; 
} 
+0

는 응답 주셔서 감사합니다. Symfony 프로파일 러가 Varnish가 활성화되어 있는지 여부가 표시되지 않는다는 사실이 이상하다고 생각했습니다. 나는 바니시가 바니시 스탯을 사용하여 일하고 있음을 확인했습니다. – Ecterion

관련 문제