Why Mautic web server setup and file permissions decide whether the install works
Mautic will not run correctly until the web server, the PHP process and the file owners agree on who can write where. Mautic is a PHP application built on the Symfony framework, and during installation and daily use it writes to cache, logs, media and configuration paths inside its project directory. If the user that serves requests cannot write to those paths, or if the PHP process runs as a different account than the one that owns the files, the install can stall at the web installer or fail later when a page, upload or background task tries to write a file. A team with its own server should treat this as a design decision made before installation, not a fix applied after the first error.
The Mautic requirements page lists Apache, Nginx or IIS as supported web servers, and it notes that npm is needed from Mautic 5.0 onward. Your web server configuration, the PHP handler (mod_php, or PHP-FPM with its own pool user) and the owner of the Mautic directory tree all have to line up. Confirm the exact PHP-FPM pool user, the web server user on your distribution and the document root you plan to use, then check the current settings against the installation guide for the Mautic version you are deploying. Do not copy server blocks or permission commands from older tutorials, since the expected paths and defaults change between releases.
Ask whoever will own the server to write down four things before anyone runs the installer: the account that serves web requests, the account that runs PHP, the account that owns the Mautic files and the list of directories that must stay writable. Keep the document root separate from the application directory where your platform allows it, and confirm with your own environment's security baseline which paths the web user may write to. Teams that skip this step usually spend the first days of the project chasing permission errors across the web installer, the cache and the logs, when the fix is a short, reviewed list of ownership and mode settings.
Apache or Nginx: how the choice changes the configuration
Both Apache and Nginx must serve Mautic from its public web directory, not from the project root that holds the Composer files, configuration and source code. If the server points at the project root, files that should never be reachable over HTTP, such as configuration and dependency folders, can be requested directly. The public directory is the only place the front controller and static assets should be exposed.
- Apache: set
DocumentRootin the virtual host to the public directory and set a matching<Directory>block with the access rules you intend to allow. - Nginx: set the
rootdirective in the server block to the same public directory, so everylocationblock resolves inside it. - Symbolic links: if you point a web root at a symlink, confirm that the web server is allowed to follow it and that the target stays inside the path you planned.
- Subdirectories: do not serve Mautic from a subfolder of an existing site unless you have a tested rewrite plan for that path.
- Mismatch checks: a 404 on the front page or a directory listing usually means the root is wrong.
Confirm the exact public directory name and the current virtual host or server block guidance in the official install documentation for your Mautic release before you write the configuration.
Neither web server runs PHP itself. Apache usually hands PHP files to the interpreter through a module or a PHP-FPM proxy, while Nginx always passes PHP requests to a PHP-FPM socket or address with a FastCGI directive. The handoff method affects how the application sees the request and which user runs the PHP process, so it has to match the file ownership plan.
- Apache: the PHP module runs inside the Apache process, or a proxy such as
mod_proxy_fcgiforwards requests to PHP-FPM. - Nginx: a
location ~ \.php$block passes requests to PHP-FPM withfastcgi_passand sends the script path throughfastcgi_param. - Socket or address: the PHP-FPM pool listens on a Unix socket or a TCP address, and the web server user must be able to reach it.
- Pool user: the PHP-FPM pool user determines which account writes the cache, logs and uploads.
- Version match: the PHP version in the handoff must be one the release supports, as listed in the requirements page.
Check the PHP version and the pool user together, because they decide which account the permission steps must target.
Mautic routes most requests through a single front controller, so the web server must send requests for paths that are not real files to that script. Apache uses rewrite rules, typically in an .htaccess file that the Apache configuration must allow, while Nginx uses a try_files directive inside the server block. The two approaches are configured in different places, which means an Apache setup that works by default may need explicit settings on Nginx.
- Apache: allow overrides for the directory and make sure the rewrite module is enabled so the bundled rules take effect.
- Nginx: use
try_filesto fall back to the front controller, and keep the PHP block separate from the static file rules. - Hidden files: deny access to dotfiles and to directories that hold configuration or source code in both servers.
- Tracking and API paths: confirm that tracking script and API paths reach the front controller and are not blocked by a static-file rule.
- Size limits: set request body limits on the web server to match the upload settings you plan for PHP.
Confirm the current rewrite and directory rules in the official install documentation for your Mautic release, since these rules change between versions.
A configuration that loads the home page is not enough to show that the server is set up correctly. Mautic relies on paths for tracking, forms, the installer and the API, and each of these can fail for a different reason. Testing each path category after changes shortens the time between a configuration error and its diagnosis.
- Front page and login: confirm that the login page loads without a 404 and that static assets are served.
- Protected paths: request a configuration or source file directly and confirm the server refuses it.
- PHP execution: confirm that PHP files run through the handoff rather than being returned as plain text.
- Tracking and forms: load a public form and the tracking script from a test page to confirm those routes resolve.
- Error logs: check the web server error log and the PHP-FPM log after each test to catch silent failures.
Before going live, confirm that these checks match the test list in the official documentation for your release.
Which file ownership and web server options fit each setup
This table compares the web server and PHP combinations listed in the Mautic requirements, showing who runs PHP, which user should own the code, which directories need write access and when each option fits. Read each column as a checklist for your own environment, and confirm the service user names against your distribution's defaults before you set ownership.
| Option | Who runs PHP and owns the code | Directories needing write access | When it fits |
|---|---|---|---|
| Apache with mod_php | PHP runs inside the Apache worker process, so the Apache service user reads and executes the code. Confirm the service user name in your distribution's defaults. | Cache, logs, media and config directories must be writable by the Apache service user. Keep the rest of the code owned by a deploy user and read-only to Apache. | A single-server VPS with a simple setup and a team that is comfortable with Apache. Ownership is easy to reason about, but all PHP runs as the web user. |
| Apache with PHP-FPM | A separate PHP-FPM pool runs the code under its own user, and Apache passes requests to it. Confirm the pool user and socket settings in your PHP-FPM configuration. | Cache, logs, media and config directories must be writable by the PHP-FPM pool user. Apache needs read access to static files only. | Teams that want PHP versions and pool settings separated from Apache, or that plan to tune PHP limits per site. |
| Nginx with PHP-FPM | Nginx serves static files and forwards PHP requests to a PHP-FPM pool, which runs the code under its pool user. Confirm the pool user and socket path for your setup. | Cache, logs, media and config directories must be writable by the PHP-FPM pool user. Nginx should not need write access to application code. | Common on Linux VPS hosts that already run Nginx. Requires careful alignment of the pool user, the document root and the directory permissions. |
| IIS | PHP runs through the FastCGI handler under an application pool identity. Confirm the identity and PHP handler configuration with your Windows administrators. | Cache, logs, media and config directories must grant write permission to the application pool identity. Use NTFS permissions rather than broad group access. | Organizations standardized on Windows Server that already operate IIS. Mautic lists IIS as supported in the requirements, so confirm the current PHP and extension support before choosing it. |
| Shared ownership across all options | The deploy user owns the code and the web or PHP user needs only specific write access. Confirm that the deploy user is not also the runtime user. | Limit writable paths to the cache, logs, media and config directories that Mautic needs at runtime. | Use this as the baseline for any option. Broad write access to the whole codebase makes later permission errors harder to diagnose. |
| Single server or split hosts | On one server, the web user and the cron user often need matching access to the same directories. On split hosts, confirm how the shared storage is mounted and owned. | The directories written by cron jobs, such as cache and logs, must be writable by whichever user runs the cron commands. | Check this early if you plan separate web and worker hosts, because a mismatch between web and cron users is a common source of errors. |
How to set up the web server and file permissions in order
This sequence takes a clean server from an installed web server and PHP runtime to a running Mautic installer with the right ownership and write access. Each step ends with a check so that permission problems surface before the installer writes configuration.
Install the web server and PHP runtime
The server administrator installs Apache or Nginx, then the PHP version and extensions that the target Mautic release requires. Confirm the PHP version your release needs on the requirements page before installing, because Mautic 7.0 supports only PHP 8.2 through 8.5. Check the result by running the PHP command-line version check and loading a test PHP page through the web server, which confirms that the web server hands PHP files to the correct runtime. Note which user the PHP runtime runs as, since that user sets the permissions you grant in later steps.
Point the document root at the public directory
Set the virtual host or server block so that the document root is the public directory inside the Mautic code tree, not the project root. This keeps configuration, vendor code and logs out of direct web reach. Reload the web server configuration, then request the site URL. A working setup returns the Mautic installer or login page, and a request for a file such as the local configuration file returns a denied or not-found response rather than its contents.
Set code ownership to a non-writable deploy user
Extract or clone the Mautic code and assign ownership of the whole tree to a dedicated deploy user, not to the web server user. The deploy user owns the code, so the web server can read and execute it but cannot change it through a compromised request. Confirm this by listing ownership on the code directory and the main entry files, and by attempting a test write as the PHP runtime user to a code file, which should fail. Record the deploy user name, since your update process will run under it.
Grant the PHP runtime write access to writable paths only
Give the PHP runtime user group or write access only to the directories Mautic needs at runtime, such as the local configuration location used by the installer, the cache, logs and media or upload folders. Confirm the exact list against the installation documentation for your release, because the required paths can change between versions. Verify by writing a test file as the PHP runtime user inside each writable path (it should succeed) and inside the code tree (it should fail). Keep the list short so that code and configuration stay protected.
Confirm the installer loads without permission errors
Before running the installer, load its page in the browser and check the web server error log for permission or file-open messages. A clean load shows the installer form with no warnings about unwritable directories. If the log reports a denied write, correct the ownership or group on the named path and reload. This check costs little and catches problems before the installer has written partial state.
Run the web or command-line installer
Complete the web installer, or run the command-line installer as the deploy user or the PHP runtime user as your runbook specifies, and enter the database connection, administrator account and site URL. Confirm success by checking that the installer reports completion and that the local configuration file now exists in the expected location with the expected owner and a restricted mode. Do not leave the installer page reachable after completion if your release documentation says to remove or disable it.
Verify cache warmup and log writes succeed
Run the cache warmup or clear command from the command line as the PHP runtime user, then trigger a few page loads and check the logs. Warmup should complete without permission errors, and the log directory should show new entries written by the runtime user. If warmup fails with a denied write, the writable path list from the earlier step is incomplete. Add only the named path, then repeat the test. Record the final ownership layout so that future updates reproduce it.
How web requests and file writes flow through the stack
A request starts at the browser, passes through the web server to the PHP runtime, and enters Mautic through the Symfony front controller in the public directory. That directory is the only part the web server should serve. Mautic then writes to cache, logs, media and configuration directories, which sit outside the public root. Check that the deploy user owns the project tree, that the runtime user has group write only where Mautic needs it, and that no writable path sits inside the document root.
Request path from browser to Mautic, with the public root separated from writable project directories.
Which errors wrong permissions cause and how they show up
Most file permission problems in a Mautic install surface as a small set of recognizable errors. Each one points to a specific directory, user or document root, so matching the symptom to its cause is the fastest way to fix it.
Installer cannot write configuration
The web installer stops before finishing, reporting that it cannot write the local configuration file. This happens when the PHP process runs as a different user than the owner of the Mautic codebase, or the config directory is read-only. Check which user the web server runs as, confirm write access to the configuration location for that user, and make sure the installer step has not already partially written the file. Confirm the exact wording in the Mautic logs for your installed release.
Cache and log errors on first load
The first page load fails with messages about the cache or log directory not being writable, often after a successful install. Mautic writes to its cache and log paths on every request, so a deployment done as root or a different account leaves those folders unwritable for the web user. Check ownership and permissions on the cache and log directories recursively, then compare them with the user in your virtual host or pool configuration. Confirm the exact message in the logs for your release.
Media uploads failing silently
Users upload images or files in the email builder or asset manager and receive a generic failure, or the file never appears. The likely cause is that the media directory is not writable by the web user, which is separate from the code and cache paths. Check the media and asset folders, confirm the web user can create files and subdirectories there, and test one upload after each change. The exact error text varies, so verify it in the Mautic logs for your installed version.
Updates and Composer steps failing
Running an upgrade, installing a plugin or executing a console command as root or a different user leaves files owned by the wrong account. The next web request or cron job then cannot read or write them, and the failure appears far from the cause. Run Composer and console commands as the same user the web server uses, or fix ownership immediately afterward. Check the owner of vendor, var and the cache directories after every upgrade step, and confirm the sequence in the release notes for your target version.
403 or 404 from the wrong document root
The site returns a 403 Forbidden or 404 Not Found on every page, or only the login page loads without assets. This usually means the web server's document root points at the project folder instead of the public folder inside it, or the reverse. The fix is in the server configuration, not in file permissions. Check that the document root targets the public directory, that rewrite rules are enabled, and that the web user can traverse each parent directory. Confirm the expected layout against the installation docs for your release.
Keeping writable directories narrow and the project tree out of the web root
The web server should serve only the public directory of the Mautic project, never the project root. Mautic's code, vendor libraries, Symfony configuration and the environment file that holds database and mail credentials all sit beside that public folder. If the document root points at the project root, a misconfigured rule or a stray file can expose source code and secrets directly over HTTP. Pointing the virtual host at the public directory is the single control that keeps everything else out of reach, so confirm it in the server configuration before the installer runs and again after each upgrade.
The PHP runtime should not own the code. Ideally the files belong to a deploy user that the web server group can read, while only the specific paths Mautic writes to (cache, logs, media and similar directories that the installer and upgrade checks identify) are writable by the web server user. When the runtime owns the whole tree, any PHP-level flaw that allows file writes can rewrite application code. Grant write access narrowly, and record which directories you opened and why. Do not treat chmod 777 as a fix for a permission error. It hides the cause, lets any local account modify files, and widens the risk for every later incident. Fix the owner or group of the specific path instead.
Configuration files that hold database and mail credentials need restricted read access, typically readable by the owner and the web server group only, and never served by the web server. Check that backups, deployment scripts and editor swap files do not leave copies in the public directory. Confirm the exact permission model, which directories must be writable and which files must stay read-only, against your own security baseline and the Mautic security guidance for the release you run, since these expectations change between major versions.
Common questions about Mautic web server and permission setup
Do we need DeployOpen to configure the web server and permissions, or can our team do it alone?
Your team can do it alone if it already runs PHP applications on Apache or Nginx and has someone comfortable with Linux file ownership, the PHP-FPM pool user and TLS. Mautic is a PHP application on the Symfony framework, so the web server must run as the same user that owns or can write to the cache, logs, media and config directories. The Mautic project states that it should not run on shared hosting, so a VPS or dedicated server with root or sudo access is the starting point either way. A partner is most useful when the setup must be documented for an audit, reviewed against your existing web server standards, or repeated across several environments. Ask for a written scope before deciding.
What drives the effort of a Mautic web server and permissions setup?
Effort follows the number of environments, the standards you already enforce, and how much of the request path is involved. The main drivers are:
- Number of environments, such as production, staging and a disaster recovery copy, each needing matching ownership and vhost configuration.
- Existing web server standards, including whether you use Apache or Nginx, your TLS setup and your logging and hardening baseline.
- SSO or reverse proxy requirements, because SAML callbacks, trusted proxies and site URLs depend on correct headers and paths.
- Infrastructure ownership, meaning who controls the server, DNS, load balancer and secrets store, and how changes are approved.
Ask any provider to show how each driver changes the work in its written scope.
Can we test the web server and permission setup in staging first?
Yes, and it is the safer order for this work. Build a staging copy on a server that matches production's operating system, PHP version and web server, then confirm that the web server user can write only to the directories Mautic needs and that the install, the admin login and a tracking request all succeed. Use the same vhost and PHP-FPM pool settings in production, because a difference in the user or socket path is a common cause of errors that appear only after go-live. Record the ownership and mode of each directory so the production change can be checked against it.
How do file permissions change after a Mautic upgrade?
Upgrades can change which files exist and which directories need write access, so permissions should be checked after each one rather than assumed to be unchanged. Mautic releases follow a monthly patch, quarterly minor and two-yearly major cadence, and the Composer-based setup means the application files are replaced during the update. Re-check ownership of the cache, logs, media and config locations, confirm the web server user still matches the PHP-FPM pool, and clear caches before testing. Keep a note of the expected ownership in your runbook so that an upgrade does not silently reset it. Keep the supported release line in view when planning, using the Mautic releases page as the reference.
What must our team provide before a web server and permissions engagement starts?
Plan to provide the following before work begins:
- Server access, with SSH and sudo rights on the Mautic host or a named contact who can grant them.
- DNS control or a DNS change owner for the Mautic domain and any tracking or proxy hostnames.
- TLS certificates or the certificate authority process you use, plus the private key handling rules.
- Database details, including host, database name, user and whether the database is on a separate host, so the application connection and permissions can be verified.
Also confirm your Mautic release, PHP version and whether a reverse proxy or load balancer sits in front. The written scope should list these inputs so gaps are found early.
What runs as the web server user, and what breaks when permissions are wrong?
The web server or PHP-FPM worker runs as a service account such as www-data on Debian-based systems or apache or nginx on others, and that account must be able to write to Mautic's cache, logs, media and similar runtime directories. When it cannot, typical symptoms include blank pages, failed installs, missing uploaded images, cache errors and log files that never update. Mismatched ownership between the deploy user and the runtime user is the most common cause. Confirm the active user with the process list and the PHP-FPM pool configuration, then test writes as that user rather than as root, since root can hide the problem.
Does the setup need to be documented for security or compliance reviews?
Often yes. Reviewers usually ask who can write to application code, which accounts run the web server, and whether runtime directories are separated from code. Record the ownership and mode of each directory, the vhost and PHP-FPM settings, the TLS configuration and the change process for each environment. This evidence supports internal controls, but it does not by itself establish compliance. Independent auditors and certification bodies issue audit reports and certifications, and DeployOpen prepares systems and evidence for those assessments rather than issuing them.
Limits to confirm in your environment before you start
Mautic's web server and file permission setup depends on a handful of environment facts that the release line, the hosting model and your host's security policies determine. Confirm each one against the vendor docs and your own environment before you choose a layout or write a single configuration file.
Release line and PHP support
Confirm which Mautic release line you will run and which PHP versions it supports. Mautic 7.2 supports PHP 8.2 to 8.5, while Mautic 7.3 is planned as the long-term support release. Check the requirements page for the matching PHP, Apache, Nginx or IIS versions, because the PHP-FPM socket path and the Apache modules you enable both depend on that choice.
Mautic requirementsVPS or dedicated server hosting
The Mautic project states that it should not be installed on shared hosting and recommends a VPS or dedicated server. Shared hosts usually restrict the file ownership, process user and web server configuration that the steps in this topic require. Confirm that you have root or sudo access to the host and can edit the virtual host or server block files directly.
PHP-FPM or mod_php model
Decide whether PHP runs through PHP-FPM behind Nginx or Apache, or inside Apache through mod_php. The model sets which user executes Mautic code, so it determines the owner you must give the Mautic files and the writable cache, log and media directories. Confirm the pool or module configuration on the host before you set permissions, because a mismatch shows up as write errors at install time.
npm availability for the build
Mautic requires npm from version 5.0 onward to build front-end assets. Confirm that npm and a compatible Node.js runtime are installed and that the user running the build can write to the Mautic project tree. Note whether your build host can reach package registries, since an air-gapped or proxied network needs a planned mirror. Running the build as root can leave files owned by root that the web server user cannot read or write later.
User and group model on the host
Map which account deploys the code, which account the web server or PHP-FPM pool runs as, and which group your administrators belong to. A common pattern gives the deploy user ownership of code and the web server group write access only to specific directories. Write this model down before you start, because the commands in this topic assume one. Confirm that no other service shares the web server user with access to Mautic's data.
SELinux or AppArmor policies
Confirm whether SELinux or AppArmor is enforcing on the host. Both can block the web server from writing to directories that have correct Unix permissions, and the failure can look like a permission error. Ask your platform or security team which policy mode applies, which contexts or profiles are already defined, and who approves changes to them. Test writes to the cache, log and media directories after any policy change.
How DeployOpen approaches Mautic web server work
DeployOpen plans and implements self-hosted Mautic inside your own infrastructure, whether that is your cloud account, a data center or an isolated network. Web server configuration and file permissions are part of that plan, not an afterthought. Before any work starts, the scope, deliverables and environment assumptions are agreed in writing, so you know which web server, PHP-FPM or module setup, document root, writable paths and service accounts will be built and who owns each of them.
On the server side, the work covers the virtual host or server block that points the document root at Mautic's docs directory, the PHP handler, the run-as user for the web server and PHP processes, and ownership and modes on the application tree and the cache, logs and media directories Mautic must write to. The same review confirms that the cron and messenger processes run as an account that can write to those paths, because a permission mismatch between the web user and the command-line user is one of the most common causes of hard-to-trace failures. DeployOpen also checks that the configuration does not expose the application source or sensitive files directly through the web server.
Hardening and documentation finish the work. Your team receives a written record of the final configuration, the ownership model, the reasons behind each permission choice and the steps to reproduce it after an upgrade. Confirm with your DeployOpen contact which hardening controls are in scope for your engagement and how they are verified, and ask for the documentation format before the engagement starts.
How DeployOpen scopes and supports Mautic web server setup
DeployOpen plans, implements and documents Mautic web server setup and file permissions inside your own infrastructure, so your team can review the configuration before it goes live. We start from a written scope, build the Apache or Nginx configuration and ownership model on your servers, then hand over the files, checks and runbooks your operators need.
How we scope
- Confirm the Mautic release line, PHP version and web server (Apache, Nginx or IIS) against the vendor requirements first.
- Record the web server user, deployment user and which directories must be writable at runtime.
- Agree in writing whether the work covers the vhost, TLS, PHP-FPM pool, cron and worker permissions, and what stays out of scope.
How we build
- Write the virtual host or server block with the document root pointing at Mautic's public directory.
- Set ownership and modes so the web server user can write only the cache, logs, media and config paths Mautic needs.
- Reproduce permission errors in a staging environment, fix them with minimal changes and record each step.
How we hand over
- Deliver the server configuration, a permissions map of every writable path and the reasons for each.
- Provide a checklist covering cron and messenger users, so background jobs do not create root-owned files.
- Document the commands operators use to diagnose permission errors and to re-apply ownership after an update.
How we support
- Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts.
- Ongoing support, upgrades and continuous testing are available as a retainer after handover.
- Ask any partner to confirm how permission changes will be reviewed when Mautic releases move to a new line.

