philiplb / CRUDlex

CRUDlex is an easy to use CRUD generator for Symfony 4 and Silex 2 which is great for auto generated admin pages
https://philiplb.de/crudlex/
MIT License
109 stars 23 forks source link

Serve assets directly using nginx #86

Closed dmaciel closed 7 years ago

dmaciel commented 7 years ago

Hi

I'm not sure where to put this, but I notice that the assets where serve trough php, and that is too slow on environments with limited resources (Raspberry Pi). To improve the situation I added the following rule to my nginx host

location /admin/resource/static { try_files /vendor/philiplb/crudlex/src/static/$arg_file =404; }

This will try to serve the assets directly from the filesystem without using php, this improve a lot the performance of the app.

Don't know where to put this in the documentation, so first want to ask the repo maintainer about his thoughts on this

The other idea is to serve the assets directly from a CDN, this will remove the burden for the server and also improve the speed. If you are interested in this route I can create the PR

philiplb commented 7 years ago

Good idea. Maybe a chapter "Web Server Optimization" here might do it? https://github.com/philiplb/CRUDlex/blob/master/docs/manual/extendedfeatures.rst I would investigate something similar for Apache. Should be doable by a rewrite rule. And then two sub chapters: nginx and Apache.

philiplb commented 7 years ago

This is online now in the manual: http://philiplb.github.io/CRUDlex/docs/html/0.12.0/manual/extendedfeatures.html#serving-static-content-via-the-webserver