Hosting Statamic on your own server: what it needs and how to set it up
6 min read
Statamic is a Laravel application that keeps its content in files. What that means for the server. The folders that must be writable, the nginx configuration, caching, the scheduler, backups and deployment, with Statamic 6.
Statamic is easy to host once you know two things about it. It is a Laravel application, so it needs what Laravel needs. And it keeps its content in files, so it needs no database, but it does need to write to more folders than a typical Laravel app.
We tested the commands here on 12 November 2026 with a new Statamic 6.41.0 project, which installed Laravel 13 and ran on PHP 8.5.
In short
- A small VPS is enough. There is no database to run.
- Point the web server at the
public/folder, never at the project root. - The PHP user must be able to write to
storage/,bootstrap/cache/,content/,users/and your asset folders. - Set
APP_ENV=productionandAPP_DEBUG=false, then warm the Stache. - Turn on static caching when the site is mostly read; it makes the largest difference.
- Back up files, not a database. And test the restore.
1. What the server needs
- PHP with the usual Laravel extensions (
mbstring,xml,curl,zip,bcmath,intl,gdorimagickfor image resizing) and Composer. - nginx, OpenLiteSpeed or Apache.
- Node.js, only if you build the front-end assets on the server.
- No MySQL, no PostgreSQL. A new project uses SQLite only for Laravel's own small tables, and Statamic's content does not live there.
Memory is the number to watch. Each PHP worker loads Laravel and Statamic. A 2 GB server runs a normal site comfortably; with static caching, most requests never reach PHP at all.
2. Get the code onto the server
Create the project locally, put it in Git, and clone it on the server:
composer create-project statamic/statamic my-site
On the server, as the site's own Linux user:
git clone <your repository> /home/mysite/app
cd /home/mysite/app
composer install --no-dev --optimize-autoloader
cp .env.example .env
php artisan key:generate
Then set, in .env:
APP_ENV=production
APP_DEBUG=false
APP_URL=https://example.com
APP_DEBUG=true on a live site shows your configuration to anybody who triggers an error. A new project has it enabled; turn it off.
3. The web server
The document root is public/. Everything else (content/, users/, .env, vendor/) must not be reachable from the web.
A minimal nginx server block:
server {
server_name example.com;
root /home/mysite/app/public;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.5-fpm-mysite.sock;
}
location ~ /\. { deny all; }
}
Run the site in its own PHP-FPM pool, as its own user. See Running several PHP versions side by side for the pool file.
4. Writable folders
This is where Statamic differs from an ordinary Laravel app. When an editor saves an entry in the control panel, Statamic writes a file. The PHP user needs write access to:
| Folder | Why |
|---|---|
storage/, bootstrap/cache/ |
Laravel's caches, logs and sessions |
content/ |
entries, taxonomies, globals, navigation |
users/ |
user accounts |
resources/blueprints/, resources/fieldsets/, resources/forms/ |
when editors change these in the control panel |
your asset containers (often public/assets/) |
uploads |
The simplest correct setup: the whole project belongs to the site's Linux user, and PHP-FPM runs as that same user. Then there is nothing to chmod. Never use 777.
5. First run
php artisan storage:link
php artisan optimize
php please stache:warm
php please make:user
stache:warm builds Statamic's index of the content files. make:user creates your control panel account; answer yes when it asks about super user. The control panel is at /cp.
6. Static caching
By default, each page view runs PHP. For a site that is mostly read, let Statamic save the finished HTML instead.
In .env:
STATAMIC_STATIC_CACHING_STRATEGY=full
With the full strategy Statamic writes each page as an HTML file, and the web server delivers it without starting PHP. For that, nginx must look for the file first. Statamic's documentation gives the rules; the core of them is:
location / {
try_files /static${uri}_$args.html $uri /index.php?$args;
}
Use the complete version from the static caching page of the Statamic documentation: it also sends form posts and live preview requests to PHP.
After each deployment:
php please static:clear
php please static:warm
If setting up the rewrite rules is too much for now, the half strategy caches pages inside the application. PHP still runs, but the page is not built again.
7. Scheduler and queue
Add Laravel's scheduler to the site user's crontab:
* * * * * cd /home/mysite/app && /usr/bin/php8.5 artisan schedule:run >> /dev/null 2>&1
Statamic uses it for scheduled entries, among other things. Without it, an entry dated for tomorrow morning does not appear tomorrow morning on a statically cached site.
A queue worker is optional. It becomes useful when you warm a large static cache (php please static:warm --queue) or send form emails in the background.
8. Content changes on the server
Editors change content on the live site, so the live server has files that your Git repository does not. Decide how they come back:
- Statamic's Git integration commits content changes on the server by itself (
STATAMIC_GIT_ENABLED=true) and can push them (STATAMIC_GIT_PUSH=true). This is the cleanest way. - Or treat
content/,users/and the assets as data: keep them out of deployments and back them up like a database.
Either way, a deployment must never overwrite content/ with an older copy from your laptop.
9. Deployment
git pull
composer install --no-dev --optimize-autoloader
php artisan optimize
php please stache:warm
php please static:clear
php please static:warm
For updating Statamic itself, see How to update Statamic safely.
10. Backups
No database makes backups simple: copy the project folder. The parts that exist nowhere else are content/, users/, the assets, storage/forms/ (form submissions) and .env.
Copy them to storage outside the server, on a schedule, and restore one to a test folder once. A backup you have never restored is a hope, not a backup.
With Zefily
Zefily installs Statamic on your own server as a one-click app: it creates the Composer project, the site user, the PHP pool, the web server rules for nginx or OpenLiteSpeed, HTTPS, and your super user account. Scheduled tasks, staging copies and backups to your own storage are part of the panel. See PHP apps.
Frequently asked questions
Does Statamic need a database?
No. Statamic stores entries, users and settings in files. A new project only uses SQLite for a few of Laravel's own tables.
Which folder should the web server point to for Statamic?
The public/ folder of the project. The project root must not be reachable from the web, because it holds .env, content/ and users/.
Which folders must be writable for Statamic?
storage/, bootstrap/cache/, content/, users/, the blueprint and form folders under resources/, and your asset folders. The simplest way is to run PHP as the user who owns the project.
How much server does Statamic need?
A small VPS is enough for a normal site, since there is no database server. With full static caching most pages are delivered as files and never start PHP.
How do I make Statamic faster?
Turn on static caching, warm the Stache after each deployment with php please stache:warm, and run php artisan optimize.
See Web stack for the PHP versions and web servers Zefily installs.