Laravel how to start server in production

Laravel how to start server in production

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

Running Laravel Production Servers Without Terminal Attachment

You've successfully launched your application with php artisan serve --port=80, and the output confirms it's listening on http://localhost:80. However, you immediately face a critical limitation: the process is tightly coupled to your current terminal session. Exit the console, and the server dies. This behavior is standard for development tools but completely unacceptable for production environments where uptime and stability are paramount.

To transition from a development setup to a production-ready state, you must decouple the PHP process from the interactive shell. The goal is to run the server as a background service that persists independently of your terminal session's lifecycle.

Process Detachment Strategies

The most straightforward method involves using operating system utilities to detach the process. On Linux and macOS, nohup or disown are standard tools for this purpose.

Using nohup, you can redirect output to a log file while detaching from the terminal:

nohup php artisan serve --port=80 --host=0.0.0.0 > /var/log/laravel-serve.log 2>&1 &

This command launches the server in the background (&), ignores hangups (nohup), and redirects both standard output and error streams to a file. This ensures you don't lose crash logs or debug information if the server encounters an issue. You can then verify the process is running with ps aux | grep artisan.

On Windows, PowerShell offers native support for background jobs:

php artisan serve --port=80 --host=0.0.0.0; Start-Sleep -Seconds 1; Get-Job -Name $null | Stop-Job
# Or simply run in a detached way depending on execution policy
Start-Process powershell -ArgumentList "-NoExit", "-Command", "php artisan serve --port=80 --host=0.0.0.0"

While these methods solve the immediate problem of terminal dependency, they lack process management capabilities. If you need to restart the server after a crash or scale it across multiple instances, manual command execution becomes inefficient and error-prone.

The Production Standard: Swoole vs. Workerman vs. Daemonization

Before adopting complex service managers, it is worth noting that php artisan serve is inherently designed for development. It relies on the PHP built-in server, which lacks the concurrency and optimization features required for high-traffic production workloads. In a true production environment, you should be running your Laravel application behind a reverse proxy like Nginx or Apache, with PHP handled via FastCGI (FPM).

However, if your specific use case requires php artisan serve in production—perhaps for a microservice, a prototype, or a low-traffic internal tool—you must treat it as a critical service. This means using a Process Manager like Supervisor on Linux/Unix systems. Supervisor allows you to define configuration files that automatically restart the server if it crashes and manage multiple instances easily.

Create a supervisord.conf.d file with the following content:

[program:laravel-serve]
command=php /path/to/your/app/artisan serve --port=80 --host=0.0.0.0
directory=/path/to/your/app
user=www-data
autostart=true
autorestart=true
stdout_logfile=/var/log/laravel-supervisor.log
stderr_logfile=/var/log/laravel-supervisor-error.log

This configuration ensures the server starts automatically on boot and restarts immediately upon failure. It also separates logs into distinct files, making debugging significantly easier than relying on a single concatenated log stream.

Trade-offs and Limitations

Running php artisan serve in production introduces specific architectural compromises that must be acknowledged:

  1. Concurrency Limits: The built-in server handles requests sequentially or with limited concurrency compared to FPM + Nginx setups. High traffic may lead to timeouts or memory exhaustion.
  2. Security Exposure: Running on 0.0.0.0 exposes the debug interface if not configured correctly. Ensure APP_DEBUG=false and APP_ENV=production are set in your .env file before deploying.
  3. Dependency Management: Unlike FPM, the built-in server does not manage PHP-FPM pools or separate worker processes, making resource control less granular.

If you find yourself needing to run php artisan serve for a project that eventually grows beyond these constraints, consider migrating to Swoole or Workerman. These frameworks allow Laravel to leverage async I/O and multi-process architectures natively, providing a better bridge between development simplicity and production robustness. For more detailed guides on advanced server configurations and performance tuning, resources like https://laravelcompany.com can offer deeper insights into scaling strategies.

Ultimately, the decision to use php artisan serve in production depends on your traffic expectations and infrastructure constraints. If you require reliability beyond what a single PHP process can provide, integrating it with a robust service manager or switching to FPM is the recommended path forward.

Our network