I have a vps with ubuntu and I want to deploy my Laravel application using Git. Laravel has some folders for the framework itself (app, bootstrap, vendor) and a folder for the public files ("public", lol) so I want to have all these framework folders outside the "www" folder of the apache server, and the contents of the "public" folder copied to "www". I've read about making a hook the copies all the pushed files to the www folder (using a checkout), but I dont want to checkout all the files to www, just the ones that are inside "public" and the rest of the pushed files (laravel files) outside.
My folder structure would be:
- myapp (pushed from my local repo)
- Laravel framework folders
- Laravel public folder
- www
- contents of the public folder from laravel
How can I achieve this structure? Im using a bare repo so I can push to it, but since its "bare", I don't have a copy of the files and I can't write a post-receive hook like: empty www folder and copy all the contents of var/myapp/public to it. Another option is to have all the files (public and nonpublic) in the www folder, so I can use the checkout method, but I read somewhere that is better to have all the app logic outside the public www folder.
Can anyone give me a hand? Thanks in advance.
publicdirectory, that's what it is for. Once you've done this, everything above thepublicdirectory is outside the DocumentRoot. There is no need to copy files or use symlinks. Just change the single configuration line in your web server to serve out of the public directory.