Reputation: 5664
It seems that Laravel serves all requests including simple static file downloads by it's own.
So in a simple web page request that might have tens of assets, each request will start a php process.
One of the main advantages people discuss when choosing nginx over apache is higher performance in serving large numbers of static file, so when using Laravel, are those static files loaded as dynamic php files?
Upvotes: 0
Views: 1194
Reputation: 153020
Let's take a look at the default .htaccess
file that ships with Laravel.
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
The important part are the two RewriteCond
itions. As you can see if the request is a file or directory it won't rewrite to index.php. So you don't have to worry if you're requesting a static file, Laravel will not bootstrap.
Regarding the 404 Error
It shows the Laravel error page because if the file can't be found the RewriteCondition will let it through to index.php
Upvotes: 2