I'm running a LAMP server on Ubuntu 16.04, typical LAMP setup. We have a family of websites running all controlled through virtual host files in the sites-available folder.
Pretty aggressive caching for the websites is handled through the global apache.conf file, and there is an opcache solution for php.
One website is experiencing some issues, but caching is preventing me from diagnosing it properly.
Preferably within the website.conf file, is it possible to configure Apache to ignore caching for only this website? I'd like to serve every request, and I'd like for PHP to be rebuilt from scratch on every request, too, (rather than be served from the opcode cache should there be a hit, and preferably without having to add a function like opcache_reset() to the top of every php page, or turn it off in the php.ini file).
1 Answer
It is possible to configure apache to ignore caching in these various contexts:
- server config - used in
httpd.conf, - virtual host,
- directory - used inside
Directory, Location, Files, If, and Proxycontainers in the server configuration files, - .htaccess
In your case its option 2 in this format CacheDisable url-string | on:
<VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined CacheDisable on # OR CacheDisable "/foo_files" # OR <Location "/foo"> CacheDisable on </Location>
</VirtualHost>Source:
4