NGINX FPM Configuration for InvoiceNinja to fix mixed-content (http/https) load errors
NGINX FPM Configuration for InvoiceNinja to fix mixed-content (http/https) load errors
December 8, 2025
Seems like putting InvoiceNinja behind a reverse proxy causes a lot of mixed-content errors on aspects of the site. This usually manifest themselves in assets, eg. pictures, not loading properly. and there are a lot of recommendations but the easieast is to just define the “fastcgi_param HTTPS “on”;” as seen below. This is the Ansible template I am presently using to deploy the NGINX configuration file
server {
listen 80;
listen [::]:80;
server_name {{ item.server_name }};
root /var/www/{{ item.server_name }}/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
index index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ ^/index\.php(/|$) {
fastcgi_pass unix:/var/run/php/php8.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_hide_header X-Powered-By;
# fixes the mixed content warnings for assets trying
# to load as http instead of https, it's required
fastcgi_param HTTPS "on";
}
location ~ /\.(?!well-known).* {
deny all;
}
}Last updated on