Skip to content
Products
Solutions
Docs
Pricing
Blog
Log in
Log in
Sign up
Sign up
Products
Solutions
Docs
Pricing
Blog
Docs
Docs
Getting Started
On this page

Server configuration

Set up the web server and PHP for a UNA 15 site: rewrite rules, a public URL PHP can reach, HTTPS behind proxies, compression, browser caching, OPcache, PHP limits, cron and mail, with the repository's nginx, Apache, Caddy and Railway samples.
Core
Base
~15.0
Source
Copy Page
Tip
Note
Important
location ~* ^/(storage|logs|tmp|cache|plugins|periodic|template/scripts|modules/boonex/files/data)/ {
    return 404;
}
location ~* ^/inc/(?!js/) {
    return 404;
}
@unaPrivate {
    path /storage/* /logs/* /tmp/* /cache/* /plugins/* /periodic/* /template/scripts/* /modules/boonex/files/data/* /inc/*
    not path /inc/js/*
}
respond @unaPrivate 404
Important
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 5;
gzip_min_length 256;
gzip_types text/plain text/css text/xml application/javascript text/javascript application/json application/xml image/svg+xml application/manifest+json application/wasm;
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml application/javascript text/javascript application/json application/xml image/svg+xml application/manifest+json
</IfModule>
Important
map $request_uri $una_static_expires {
    ~*/cache_public/[^/?]+          1y;
    ~*[?&]rev=[0-9]+(&|$)           1y;
    default                         30d;
}
map $request_uri $una_static_cache_control {
    ~*/cache_public/[^/?]+          "public, immutable";
    ~*[?&]rev=[0-9]+(&|$)           "public, immutable";
    default                         "public";
}

location ~* \.(?:woff2?|ttf|otf|eot|svg|png|jpe?g|gif|webp|avif|ico|css|js|mjs|map)$ {
    try_files $uri @dynamic;
    expires $una_static_expires;
    add_header Cache-Control $una_static_cache_control;
    access_log off;
}

location @dynamic {
    rewrite "^/s/([a-zA-Z0-9_]+)/([a-zA-Z0-9\.]+)" /storage.php?o=$1&f=$2 last;
    rewrite ^/(.+)$ /r.php?_q=$1 last;
}
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/css                  "access plus 30 days"
    ExpiresByType application/javascript    "access plus 30 days"
    ExpiresByType image/png                 "access plus 30 days"
    ExpiresByType image/jpeg                "access plus 30 days"
    ExpiresByType image/webp                "access plus 30 days"
    ExpiresByType image/svg+xml             "access plus 30 days"
    ExpiresByType font/woff2                "access plus 365 days"
    <Files "sw.js.php">
        ExpiresActive Off
    </Files>
    <If "%{REQUEST_URI} =~ m#/cache_public/[^/]+$# || %{QUERY_STRING} =~ /(^|&)rev=[0-9]+(&|$)/">
        ExpiresByType text/css                  "access plus 1 year"
        ExpiresByType application/javascript    "access plus 1 year"
        ExpiresByType image/png                 "access plus 1 year"
        <IfModule mod_headers.c>
            Header merge Cache-Control "immutable"
        </IfModule>
    </If>
</IfModule>
@static {
    path *.woff2 *.woff *.ttf *.otf *.eot *.svg *.png *.jpg *.jpeg *.gif *.webp *.avif *.ico *.css *.js *.mjs *.map
    not path /s/*
    not path_regexp /cache_public/[^/]+$
    not query rev=*
}
header @static Cache-Control "public, max-age=2592000"

@staticVersioned {
    path *.woff2 *.woff *.ttf *.otf *.eot *.svg *.png *.jpg *.jpeg *.gif *.webp *.avif *.ico *.css *.js *.mjs *.map
    not path /s/*
    not {
        not path_regexp /cache_public/[^/]+$
        not query rev=*
    }
}
header @staticVersioned Cache-Control "public, max-age=31536000, immutable"
opcache.enable=1
opcache.memory_consumption=256
opcache.interned_strings_buffer=32
opcache.max_accelerated_files=100000
opcache.max_wasted_percentage=20
opcache.validate_timestamps=1
opcache.revalidate_freq=0
    cron:
        volumes:
            - ./scripts/docker-compose/php-cron.ini:/usr/local/etc/php/php.ini
            - ./:/opt/una
3d
On this page
I want to...Web server and rewriteClosed folders on nginx and CaddyPublic URL reachability from PHPSite URL, HTTPS, and proxiesSite URL from the environmentCompressionnginxApache mod_deflateCaddyStatic asset cachingnginxApache mod_expiresCaddyApache, nginx, Caddy, and RailwayPHP OPcachePHP runtime floorsPermissions, cron, and uploadsFix the Compose cron container PHP settingsMailAfter upgradesTipsTroubleshootingSymptoms → likely causeFor developersGitHub SourcesRelated docs
Introduction
Getting Started
License
Concepts
Architecture
Requirements
Server configuration
Installation
Deployment
Releases
Upgrades
NEO
Glossary
Roadmap
Database Migrations
Configuration
Apps
CODE
Auth
Connect