CakePHP 3.8 deployed on NGINX server on Ubuntu 16.04.
Created plugin using bin/cake bake plugin Ocean. Can access all assets on /ocean/js, and /ocean/img, but when trying to access /ocean/css the *.css files return error 404.
I SSH’ed to the server and created couple of test files alongside the *.css and all of them I can access through https://example.com/ocean/css/whateverfile.txt, as long as they’re not CSS files. I have no problems accessing CSS files in the main app location (i.e. https://example.com/css), but plugin CSS don’t work. I tried creating couple more plugins with the same results.
I checked NGINX server configuration, but suspect this is somehow related to my app configuration…? routes? re-writes…?
First of all, welcome to the forums, I hope you’ll have a nice time baking with us
Anyhow, back to the question.
Are you getting a CakePHP error or a Nginx error?
If it’s a CakePHP error, it should say something along the lines of: “Missing controller 'css'”, if it’s an Nginx error, well… you should get an nginx page saying “404”.
If you are getting an CakePHP error, that means Nginx can’t find the file itself and just hands it off to CakePHP to handle.
If you are getting an Nginx error, that means it both can’t find it and doesn’t hand it off to CakePHP to handle either.
Thanks for the warm welcome and for the advice. Appreciate it!
Turns out it was NGINX server configuration file that was causing the problem. I failed to add in the question that my plugin triggers theme (plugin) based on the domain the app is served from. In my NGINX configuration I had some rewrite rules from earlier renditions of CakePHP, which were causing the 404 errors.