Documentation » Administration
Keep Private Files Private on nginx
Groundhogg keeps some files in its own uploads folder, wp-content/uploads/groundhogg/, that only you and your team should be able to download: contact imports, exports, and files uploaded for contacts, like attachments from forms. Groundhogg protects that folder with an .htaccess file that tells the server to refuse anyone who asks for those files directly.
Apache and LiteSpeed servers read .htaccess files, so on most hosts there’s nothing to do. nginx doesn’t read them. If your site runs on nginx, those files can be downloaded by anyone who knows or guesses their link, until you add a few rules to your server’s config.
Two Folders Need to Stay Public #
Two folders inside Groundhogg’s uploads folder hold files your readers’ mail apps have to download, so they have to stay public:
email-fonts/: the font files of your custom email fonts.email-video-thumbnails/: the thumbnails of your email Video blocks.
The rules below keep everything else private, and let only font files and thumbnail images in those two folders through. If you’ve already blocked the whole groundhogg folder on nginx, which was the right thing to do before Groundhogg 4.13, replace that rule with these, or your custom fonts and video thumbnails won’t show in emails.
Check Whether Your Site Needs This #
You don’t need to know what your server runs. Groundhogg checks for you: it puts a test file in its uploads folder and asks your site for it, the way a stranger would. Go to Tools » Site Health in WordPress and look for one of these results:
- Private files can’t be downloaded: all good. Private files are protected, and mail apps can load your fonts and thumbnails. It’s listed under Passed tests.
- Private files can be downloaded by anyone: a critical issue. Add the rules below.
- Mail apps can’t load email fonts and video thumbnails: your private files are safe, but the server blocks the two public folders too. Replace the rule that blocks Groundhogg’s uploads folder with the rules below.
- Couldn’t check that private files are protected: your site couldn’t make a request to itself. WordPress’s own loopback request check in Site Health usually says why.

Add the nginx Rules #
When Site Health finds a problem, it shows the exact rules for your site, with your site’s own folder paths filled in. Copy them from there.
On a standard WordPress install, they look like this:
location ^~ "/wp-content/uploads/groundhogg/" {
deny all;
location ~ "^/wp-content/uploads/groundhogg/email-fonts/[^/]+\.(woff2|woff|ttf|otf)$" {
allow all;
add_header Access-Control-Allow-Origin "*";
}
location ~ "^/wp-content/uploads/groundhogg/email-video-thumbnails/[^/]+\.(jpg)$" {
allow all;
add_header Access-Control-Allow-Origin "*";
}
}
- Open your site’s nginx config, and add the rules inside its
serverblock. - If there’s already a rule for
/wp-content/uploads/groundhogg/, remove it, or the two won’t agree. - Test the config, then reload nginx so it uses the new rules.
- Reload Tools » Site Health to check that the result is now Private files can’t be downloaded.
The ^~ on the outer rule matters: it stops other rules in your config, like one that caches images, from serving files out of the folder before these rules get a say.
On managed hosting? Most managed hosts don’t let you change the nginx config yourself. Send these rules to your host’s support team and ask them to add them to your site. Copy the rules from Site Health rather than from this page, so they have your site’s paths.
Multisite #
On a multisite network, each site has its own Groundhogg uploads folder, like wp-content/uploads/sites/2/groundhogg/2/. The rules in Site Health are for the site you’re looking at, so check Site Health on each site that uses Groundhogg and add the rules it shows.
On Apache #
Apache reads the .htaccess files only if the server allows them. If Site Health warns you on an Apache server, ask your host to make sure AllowOverride allows .htaccess files for your site, for example AllowOverride All. Custom fonts also need Apache’s mod_headers module, which sends the header mail apps look for.
Check It Yourself #
Open the link to one of your font files in a private browser window. Your browser should download it, and your browser’s developer tools should show an access-control-allow-origin: * header on it. Then open the link to a file you’ve exported, in Groundhogg’s exports folder: you should get a 403 Forbidden page instead of the file. Open a file’s link, not the folder’s, because nginx refuses to list folders anyway.
FAQs #
Were my files public before Groundhogg 4.13?
On nginx, yes, unless you or your host had already blocked the folder. Groundhogg 4.13 added the Site Health check so you can find out. Exported files have random names that are hard to guess, but import files keep the name they were uploaded with, so add the rules even if nothing has happened.
Why are my video thumbnails broken after updating?
Since Groundhogg 4.13, new thumbnails are saved in Groundhogg’s uploads folder. If your server blocks that whole folder, new thumbnails won’t load in emails, so use the rules above in its place. Emails you’d already made weren’t changed if the folder was blocked when you updated: they keep their old thumbnails, which still work.