Sometimes a site needs web server settings that .htaccess cannot provide: a larger request body limit in Nginx, a special proxy rule, extra security headers or a custom PHP-FPM option. DirectAdmin lets admins add these per domain without editing generated config files that would be overwritten.
Before you start
- Admin-level access and root SSH.
- Know which web server the server uses (Apache, Nginx, Nginx+Apache, LiteSpeed or OpenLiteSpeed); see CustomBuild.
Open Custom HTTPD Configurations
- At Admin Level, go to Server Manager → Custom HTTPD Configurations.
- Click the domain.
- You see the generated configuration and fields to insert custom text. With Nginx+Apache there are separate tabs for each server.
Add custom directives
Enter directives in the custom field and save. DirectAdmin inserts them into the domain's virtual host at the right place and reloads the web server. Examples:
- Nginx:
client_max_body_size 256m;to allow large uploads. - Apache:
Header always set X-Frame-Options "SAMEORIGIN"for a security header. - Reverse proxy to a local app, for example a Node.js service listening on
127.0.0.1:3000.
DirectAdmin validates the config; if the web server rejects it, the change is not applied. Still, test on a staging domain first.
CUSTOM tokens
The templates contain tokens such as |CUSTOM|, |CUSTOM1| … |CUSTOM4| at different positions (inside the server block, inside location blocks, for HTTPS only). Choosing the right token puts your directive in the correct context. The custom configuration screen shows which token each field fills.
Server-wide changes with custom templates
For settings every domain should get, copy the template from /usr/local/directadmin/data/templates/ to the custom/ subfolder, edit it, then rebuild:
cd /usr/local/directadmin/custombuild && ./build rewrite_confsNever edit files in /etc/httpd/conf/extra/ or /etc/nginx/ generated by DirectAdmin directly – they are regenerated.
PHP-FPM pool options
Per-domain or per-user PHP-FPM settings (for example pm.max_children) can be set through the PHP-FPM custom configuration for the user or via custom templates. Raise them for busy sites that hit 503 errors; see PHP settings.
Troubleshooting
- Change not applied: syntax error rejected by the web server, or wrong token context.
- Directive ignored: it belongs to the other web server (for example an Apache directive while Nginx serves the request).
- Lost after rebuild: it was edited in a generated file instead of custom configs or templates.
