Apache2 or Nginx for Laravel
How Apache and Nginx handle connections, what .htaccess means for performance, and when each server makes sense for a Laravel application.

Both servers do the same job: accept a request, serve a static file or pass a PHP request to FPM. They differ in how they hold connections and how they are configured.
Process model
Nginx has a small number of worker processes, and each one handles thousands of connections through an event loop. Memory use barely grows with the number of connections.
Apache depends on the MPM. prefork uses one process per connection. event uses threads and keeps keep-alive connections cheap, so with PHP-FPM the gap to Nginx is much smaller than people usually think.
.htaccess
With AllowOverride All, Apache looks for .htaccess in every directory on the path on every request. That costs time, but it lets rules change without reloading the server, which is why hosting panels like it. Laravel ships with a ready-made public/.htaccess.
Nginx has no .htaccess. Everything lives in the server configuration and is loaded once:
root /var/www/app/public;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
What to choose
- Your own VPS with one or a few Laravel applications: Nginx. Less memory, and a simple reverse proxy for WebSocket and Node services.
- Shared hosting, a control panel, or applications that rely on
.htaccessrules: Apache with theeventMPM and PHP-FPM.
Either way, most of a request's time goes to PHP and the database. Switching the web server rarely fixes a slow application.