Clone the Repo in a not public folder, copy /public/ content in the public_www folder (or the name on the shared server) anche fix the path in index.php of the two "require" commands.
If the Shared Host use Symbolic link for public directory (es cPanel create a directory named public_www, anche a symbolic link www => public_www ) use SSH to login the server, change the link to the public folder of the laravel application.
I think that there are pros and cons on every point, but I would like some skilled opinions!!
Obviously the best solution is number 3. There's no real way that can ever expose your code, unless something seriously changes with the setup (point it to the wrong folder).
If your shared host supports/allows symlinks, great!
@jlrdw Yup, it's a shame and I'm not sure what this topic is actually asking really. Pros and cons? So many opinions and endless chat about security :P
In this day and age of cheap cloud hosting (you can get them for $5/mo), I really don't see why people still bother with shared hosting. It's so much easier to have 100% control of your server and no "shared hosting" problems.
@Cronix is there a decent guide for cloud based hosting? One where you directly place the files on the host, with no Forge. I.e., can you still FTP your site, etc.
And wouldn't you still have main Laravel placed in a higher folder than the one serving web files.
It would be neat to have two guides to post for folks, and let them go from there.
@jlrdw There are tons of guides. Sure you could use ftp, but why? Use scp as it's secure and you don't have to leave port 21 open, which is widely abused and scripts hunt for since it's a common port. Or use ssh with keys and git hooks for automatic deployment
Google "laravel digitalocean" and you will find tons of guides, by digital ocean themselves. Or google "laravel aws", etc.
And wouldn't you still have main Laravel placed in a higher folder than the one serving web files.
Totally. You'd just set laravels "public" dir to be the site root. Another benefit to having your own server. You can edit the apache/nginx configs directly.
Thanks @Cronix this post will become a good source for someone wanting to deploy and Like Jeffrey said, we were all new to this stuff at one time. So I try to have good links to help new folks when I can.
It's discussions like this that can really help people.
I used apache for about 15 years and when nginx came out and was outperforming it, I switched to that and haven't used apache since, unless a client was already set up on it.
@doni49 Linux is very secure by default. Obviously the more packages you install, the more security risk there is but all you have to do is install/change a few things to make it secure then it's just a matter of sudo apt upgrade for updates.