laravel-deploy-on-shared-hosting
laravel-deploy-on-shared-hosting copied to clipboard
Sub-domains: Inverse the symlink to point to the public/ dir from public_html for updates
Hi.
I'm using https://servicioshosting.com, and instructions works! :clown_face:
But... When I use git pull I get some issues, since public is a symbolic link and I have to make cp ... mv ... etc each time I update content in my public/ folder in my repo.
For sub-domains, I use a symbolic link as sub-domain "folder" to point to my awesome/public/ folder directly:
ln -s ~/apps/awesome/public ~/public_html/awesome
It's working like a charm; no need to modify the routes in my public/index.php.
My questions are...
There something I'm not considering that will become a trouble later?
It only works in https://servicioshosting.com and may fail in other hosting providers?
I have tested your configuration on a godaddy server, but I have the following error:
"symbolic link not allowed or link target not accessible"
So I imagine that not all the hosting are prepared to support symlinks towards directories outside of public_html / www
Anyway, it is a good setup if the server allows it, more simple to get updated the sources
This method works on Web Hosting Canada, and it does make updating the project much easier. @josevavia, are you sure it was your server that was causing the error, or could it have been the creation of the symbolic links? I also ran into that issue, but I was able to solve it by making sure permissions were set correctly and that the symbolic link directories did not exist before creating the symbolic link.
I was planning to update this guide for Laravel 5.6 and figured I would invert the symlink as well, since it seems like a nicer way to update projects. If there are any further issues with this method, please let me know - or maybe we could keep the original method as an alternate method in the case that the server doesn't allow this 'inverted' symlink.
As I experience so far, only minor of shared hosting provides symlink.
And still, we always need to verify if public/index.php is loaded correctly or not.