This guide covers deploying Stratus to a production server running Apache or Nginx. Follow the steps in order for a clean first-time deployment.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/AlexanderDamont1/Stratus/llms.txt
Use this file to discover all available pages before exploring further.
Pre-deployment checklist
Before going live, verify the following.env values:
DB_*variables point to your production database.MAIL_*variables are set to a real SMTP provider.SESSION_DRIVER=database(recommended for all production deployments).QUEUE_CONNECTION=databaseif you need background job processing.
First-time setup
Install dependencies and build assets
The This runs the following commands in sequence:
setup script handles the full first-time installation:Set file permissions
The web server process must be able to write to Replace
storage/ and bootstrap/cache/:www-data with the user your web server runs as (e.g. nginx, apache, or caddy).Configure your web server
Point your web server’s document root to the
public/ directory. See the web server configuration section below.Start the queue worker
If you are using
QUEUE_CONNECTION=database, start a supervised queue worker. See Queue worker in production.Subsequent deployments
For updates after the initial install:Web server configuration
Thepublic/ directory is the only directory that should be publicly accessible. All application code, configuration, and the .env file sit above the document root.
- Nginx
- Apache
Queue worker in production
WhenQUEUE_CONNECTION=database, jobs are stored in the jobs table and must be processed by a long-running worker. Use a process supervisor such as Supervisor to keep the worker running and restart it automatically.
Example Supervisor configuration (/etc/supervisor/conf.d/stratus-worker.conf):
If you set
QUEUE_CONNECTION=sync, jobs run synchronously in the web request and no worker is needed. This is acceptable for low-traffic deployments but will slow down HTTP responses when jobs are heavy.Cache configuration for production
file driver works out of the box. For better performance under load, switch to redis:
Session driver recommendation
UseSESSION_DRIVER=database in production. It is the most reliable option for both single-server and load-balanced multi-server deployments because session data is stored centrally in the database rather than on local disk.
For very high-traffic deployments, Redis is a faster alternative:
Environment variables security
Protecting the .env file
Protecting the .env file
The
.env file must not be web-accessible. If your document root is correctly set to public/, the file is already out of reach. Verify with:Using environment variables instead of .env
Using environment variables instead of .env
In containerised or managed hosting environments (Docker, Kubernetes, Heroku, Forge), you can inject environment variables directly into the process rather than using a
.env file. Laravel reads from the OS environment first. Cache configuration after setting them:Rotating APP_KEY
Rotating APP_KEY
If This will invalidate all existing encrypted values, including sessions and cookies, logging all users out.
APP_KEY is ever compromised, generate a new one: