One thing that annoyed me after switching to Ghost was it offers no options to serve static files. For example, there is no option in Ghost to add add ads.txt or any other verification files to the root of the blog. So, we have to add them manually.
Fortunately, the task is quite easy. There are two to ways to add files to the root of a Ghost blog.
- Add them with the theme files. (Easiest)
- By making a couple adjustments to your Nginx configuration.
Add files with the theme files
To add files to theme, login to Ghost admin dashboard and navigate to Settings -> Design and download the active theme.

Extract the theme and add your files to the root directory (you will see default.hbs
or index.hbs
there) of theme.
Zip it and upload it back to Ghost blog (Click on Upload a theme button).
Finally, activate the theme.
Note: If you already tried to access the ads.txt file url before, browser will cache the result and keep redirecting you even after you added the file. It is recommended to use another browser or a private tab.
By making changes to Nginx configuration
First, login to your VPS and open the default Nginx configuration file.
cd /etc/nginx/sites-available/
nano your-nginx-config.conf
The file should look similar to this:
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
server_name fayimora.com; # Replace with your domain
root /usr/share/nginx/html;
index index.html index.htm;
client_max_body_size 10G;
location / {
proxy_pass http://localhost:2368;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
}
}
Next, add this block after the location /
block:
location /static/ {
alias /var/www/ghostblog/static/;
}
If you have not created the folder, create it using mkdir
command.
mkdir -p /var/www/ghostblog/static
Then restart Nginx using sudo service nginx restart
Now you can save your static files to /var/www/ghostblog/static/
folder. Please note that the url will be https://www.yoursite.com/static/static-file.file
.
If you want to serve files from the root of your domain, add this block.
location /ads.txt {
alias /var/www/ghostblog/static/ads.txt;
}
Note: If you already tried to access the ads.txt file url before, browser will cache the result and keep redirecting you even after you added the file. It is recommended to use another browser or a private tab.