i have hosted laravel project on shared hosting. I Dont understand how to handle public folder. Although i tried using .htaccess . it worked by hit and trial, but i am not confidant about it. Further i created a subdomain. that is not working because its not finding index.php. i have uploaded all my project to public_html. also created another folder in it - named ''sub", in which i copied whole another laravel project & added its directory - "public_html/sub" in subdomain . Subdomain is not working at all. what is proper way ?
#Laravel shared hosting
1 messages · Page 1 of 1 (latest)
You should never upload a Laravel project in a public_html folder, it would make your entire app available (including .env files etc). Instead you'd point your document root to the public folder of your app.
Generally that's why it's a nightmare to use a shared host, since they often don't allow any modifications.
since project is small for now, i didnt want to spend much. but anyhow, if i have to spend, what do u recommend ? what is cheepest option ? vps hosting or any other cloud hosting ?
i am new to laravel.
Hi, just like @fluid ingot said, the best way is to pay for VPS hosting because you can configure it as you need.
Some hosts do not charge for domain registration for new users.
i have purchased vps hosting. Should i buy vps manager too.? ??
i want to deploy my project using git
https://laravel-news.com/push-deploy-with-github-actions
so just deploy it? if you asking for the steps, it would be things like
- ssh into the server
- create an deploy token
- add the token to the repository
- execute
git pull or git cloneat the server - setup the .env
- etc
i have spend a lot of time, in publishing project on vps server. Since i am doing it 1st time, it is feeling quite difficult . Have to do a lot of things manually in ssh using putty. Can u please suggest some methods or tricks or anything to make it easy or understand it. For example, i installed apache , composer & other things required, That part i understand. Now, deployement of code seems difficult because their is no ui. Can u please guide me. Because after deploying it 1st time, also need to update regularly , need to run php artisan migrate again & all.
Hello @limber quail everything is fine?
Many things can be automated with Artisan.
This article should help you with part of the process, mainly migrations, view caching, routes, tests, etc.
https://dev.to/marciopolicarpo/que-tal-automatizar-conscientes-com-artisan-1-4pp6
You can always use some hooks for composer post-update, so that it runs any new migrations once you've run composer update, you can do the same for your git pull etc, so that migrations will just run once you update
You can also look at Laravel Envoy, so that you can call actions from a trusted machine (e.g. you can tell it to do a composer update/git pull/artisan migrate)
You don't need a GUI to do all of that type of activity, if you're struggling with something in particular, then explain which bits, and someone will be able to advise
Follow a Youtube tutorial to learn how to manually deploy. We can't hand hold you every step of the way.
@manic minnow every thing is good. Thanks How are you ? i created a .sh file to automate it. thanks. and sir , link u provided showing page not exist. was it temporary ?
@severe temple Thank You.
@north krakenThanks
@lethal void yes , i am doing that. i was over overwhelmed before . i created a .sh file to automate it. Thanks.
Well worth considering putting it into your project's composer file
Also worth looking at Envoy (or Envoyer for a cloud solution):
https://laravel.com/docs/10.x/envoy
Envoy effectively allows you to run commands/tasks remotely
@limber quail Sorry for the mess. This is the correct link: https://dev.to/marciopolicarpo/que-tal-automatizar-tarefas-com-artisan-1-4pp6