简体   繁体   中英

Store unique hits in mysql database

I have a hit counter written in php, it stores unique page views from IP in mysql database.

problem is I set up varnish cache and since content is served from cached pages my counter is not working, since apache is not getting that request.

how to go around this problem for storing unique hits and displaying them?

Look into the statistics you can get from Varnish:

https://www.varnish-cache.org/docs/2.1/tutorial/statistics.html

Since Varnish is caching the document, as you know, its not hitting your Apache, exactly as you said. So you're going to have to figure out some way of getting that information. And since you cannot get it from Apache/PHP well then Varnish is your only option.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM