Laravel on shared hosting

Published 1 week ago by dohisev

I have a shared hosting with ssh access, I managed to install laravel, run npm run prod, but as I can't run the server by php artisan serve I need to make the server to run the php directly so I renamed the server.php file to index.php and put the .htaccess from public to the root folder and it's working but it doesn't find the css and js files that has been generated. I'm using like this: <link rel="stylesheet" href="{{ mix('css/app.css') }}"> but can't find.

Best Answer (As Selected By dohisev)
rumm.an

@dohisev You dont need to rename any of your files or move them, as long as your hosting provider allowes you to change Document Root, you need to set it to public directory in your project. That's it and it works. Go ahead reset everything you've done, and change DocumentRoot. If this doesnt help, Let me know which hosting service are you using? maybe, I can help more specifically.

dohisev

Anyone? I really need help with this.

jlrdw
jlrdw
1 week ago (199,820 XP)

If you search this forum I myself and others have given links to how to properly set up in shared hosting. In fact I was kind of ticked off at one person who would not listen and I actually downloaded got everything working and got version 5.5 setup and completely working in shared hosting in just one evening with zero problems.

dohisev

I have now ssh access to the server, it means that I can create an apache virtual host and it should run properly right?

rumm.an
rumm.an
1 week ago (21,850 XP)

@dohisev You dont need to rename any of your files or move them, as long as your hosting provider allowes you to change Document Root, you need to set it to public directory in your project. That's it and it works. Go ahead reset everything you've done, and change DocumentRoot. If this doesnt help, Let me know which hosting service are you using? maybe, I can help more specifically.

Snapey
Snapey
1 week ago (678,595 XP)

and don't even consider running php artisan serve in production.

If you have shared hosting i would expect it to have nginx or apache already installed ? Speak to the hosting company for advice

dohisev

@rumm.an you are right, I solved that way, thank you.

Please sign in or create an account to participate in this conversation.