cache
Generate the PHP page-cache script for one domain or all domains from their cache settings
- Command:
/go/cache - Category: Performance
- Required option: None
- Output: None (writes
/home/<domain>/etc/cache.php) - Last updated: 2026-11-20
On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also
Overview
/go/cache builds the page-cache script of a domain from the cache settings saved for it in GoAdmio. A cached page is a copy of the finished HTML that is served again without running the site's PHP code, which makes repeat visits faster and reduces server load.
The command:
- reads the domain's cache settings from the database
- writes the cache script to
/home/<domain>/etc/cache.php - can do this for every domain in one run
It does not delete cached pages. See Clearing the cache.
Quick start
# Rebuild the cache script for one domain
/go/cache example.com
# Rebuild it for all domains
/go/cache all
Syntax
/go/cache [domain|all]
If you run it without root, it re-runs itself with sudo.
Options
| Argument | What it does |
|---|---|
<domain> |
Rebuilds the cache script for that domain only. |
all |
Rebuilds it for every domain. |
| (none) | Same as all. |
A domain is skipped silently when /home/<domain>/www does not exist.
Cache settings
The settings are read from the Site table in /var/lib/sqlite/site.db. Run the command again after you change them.
| Setting | Meaning |
|---|---|
CacheTTL |
How long a cached page stays valid, in seconds. 0 turns the cache off. |
CacheActive |
1 turns the cache on, 0 turns it off. |
CacheLength |
0 means no limit. Any other value means only URLs longer than this many characters are cached, so shorter URLs (such as the home page) are never cached. |
CacheExclude |
Extra URL parts that must never be cached, separated by |. |
Output
The command prints nothing. To check the result, open the generated file:
cat /home/example.com/etc/cache.php
Each run also adds a line to /var/log/go/cache.log.
Examples
# Rebuild one domain, then all domains
/go/cache example.com
/go/cache all
# See the current cache settings of a domain
sqlite3 /var/lib/sqlite/site.db "select CacheTTL,CacheActive,CacheLength,CacheExclude from Site where Domain='example.com'"
# Change the cache time to one hour and apply it
sqlite3 /var/lib/sqlite/site.db "update Site set CacheTTL=3600 where Domain='example.com'"
/go/cache example.com
# Clear the cached pages of a domain
rm -f /var/cache/example.com/*.html
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Nothing happens for a domain | /home/<domain>/www does not exist. |
Check the domain name and that the account exists. |
| Changes to the settings have no effect | cache.php was not rebuilt. |
Run /go/cache <domain>. |
| Pages are not cached | CacheTTL is 0, CacheActive is 0, the URL matches an excluded part, or the URL is not longer than CacheLength. |
Check the settings. |
| Pages are not cached, but the settings are right | The cache folder /var/cache/<domain> is missing or not writable by the site's PHP user. |
Create it, and make it writable. |
| Old content keeps appearing | Cached pages are still valid. | Delete the files in /var/cache/<domain>/, or lower CacheTTL. |
| The site shows a blank page or a PHP error after the command | A setting was empty, which creates invalid PHP (see Known issues). | Set CacheActive and CacheLength to numbers, then run the command again. |
| A page that should not be cached is cached | Its URL does not match an excluded part. | Add a part of the URL to CacheExclude and run the command again. |
Details
What the generated script does
For every request, the script:
- Stops and does nothing when
CacheTTLis0,CacheActiveis0, the URL matches an excluded part, or the URL is not longer thanCacheLength. - Looks for a saved copy in
/var/cache/<domain>/. The file name is the MD5 hash of the full URL (scheme, host, path, and query string) plus.html.httpandhttpsversions, and different query strings, are cached separately. - If the saved copy is not older than
CacheTTL, sends it and stops. - Otherwise lets the page run normally, and saves the result if it contains
</html>or</body>.
The command only writes the script. Loading it for the site is done by the site's PHP configuration, not by this command.
Excluded URLs
These parts are always excluded: admin, /cp, login, sign, logout, forget, webmail, dashboard, and ajax. Anything you add to CacheExclude is added to this list.
A URL is excluded when it contains any of these parts, so sign also matches /design. Dots and slashes are escaped, so a dot in your list means a literal dot.
Clearing the cache
The command only writes the script. To clear a domain's cached pages, delete the .html files in /var/cache/<domain>/. To clear Cloudflare's copy, use purge.
Security
[!WARNING] The command sets the permission of
cache.phpto777, so any user on the server can change a file that runs as PHP on the site. Use a stricter permission such as644.
Known issues
- The script does not check the request method, cookies, or the response status. POST requests and pages shown to logged-in users are cached too, unless the URL is excluded. Add such URLs to
CacheExclude. - The values of
CacheExcludeare written into the PHP file without checks. Quotes,$, or an invalid pattern can break the file. - If
CacheActiveorCacheLengthis empty in the database, the generated file contains$CacheActive=;or$CacheLength=;, which is invalid PHP. - The cache folder is not created by this command.
See also
| Command | Description |
|---|---|
purge |
Delete the Cloudflare edge cache (purge everything) |
clean |
Clean and remove unnecessary files to free up space |
fpm |
Restart all installed PHP-FPM versions on your server |
gzip |
Enable or disable gzip compression in the web server |
conf |
Rebuild the Apache/Nginx configuration in GoAdmio |