Nginx Installation

How to install OpenDataBio with nginx

These instructions are for an nginx-based installation. If you prefer Apache, use the Apache installation page.

Server requirements

  1. Supported PHP version >= 8.2 (8.3 recommended).
  2. Web server: nginx.
  3. SQL database: MySQL or MariaDB (tested with MySQL 8.0 and MariaDB 10.6+).
  4. Required PHP extensions: openssl, pdo, pdo_mysql, mbstring, tokenizer, xml, dom, gd, exif, bcmath, zip, curl, redis.
  5. Redis for queues/cache.
  6. Tectonic for label PDF generation.
  7. Pandoc for bibliographic rendering (recommended).
  8. Supervisor for background jobs.

Nginx site config

Create your site config file (example):

sudo nano /etc/nginx/sites-available/opendatabio

Use this base server block (adjust paths/domain):

server {
    listen 80;
    server_name your-domain.example;

    root /home/odbserver/opendatabio/public;
    index index.php index.html;

    charset utf-8;
    client_max_body_size 300M;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_read_timeout 300;
    }

    location ~ /\. {
        deny all;
    }
}

Enable and reload:

sudo ln -s /etc/nginx/sites-available/opendatabio /etc/nginx/sites-enabled/opendatabio
sudo nginx -t
sudo systemctl reload nginx

Content Security Policy (CSP)

Edit the same nginx site file and add inside the server { ... } block:

add_header Content-Security-Policy-Report-Only "
  default-src 'self';
  base-uri 'self';
  form-action 'self';
  frame-ancestors 'self';
  object-src 'none';
  script-src 'self' 'unsafe-eval';
  style-src 'self' 'unsafe-inline';
  img-src 'self' data: https://server.arcgisonline.com https://*.tile.openstreetmap.org;
  font-src 'self' data:;
  connect-src 'self';
" always;

Then reload:

sudo nginx -t
sudo systemctl reload nginx

Notes:

  1. Start with Report-Only, then move to enforced CSP after validating logs.
  2. https://server.arcgisonline.com and https://*.tile.openstreetmap.org are required for map tiles.

Subpath installs (/opendatabio)

If your installation runs under a subpath (for example http://localhost/opendatabio), set in .env:

APP_URL=http://localhost/opendatabio
ASSET_URL=http://localhost/opendatabio

Then refresh generated assets and Livewire files:

php artisan livewire:publish --assets
php artisan optimize:clear
npm run build

Shared application setup

To avoid repeating the same instructions, use these sections from Apache installation (they also apply to nginx deployments):

  1. PHP settings (php.ini) in Apache Installation
  2. Configure supervisord in Apache Installation
  3. Folder permissions in Apache Installation
  4. Install OpenDataBio in Apache Installation
  5. Post-install configs in Apache Installation
Last modified March 11, 2026: Updated installation instructions (d5014ec)