Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

dohisev's avatar

Laravel on shared hosting

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.

0 likes
6 replies
dohisev's avatar

Anyone? I really need help with this.

jlrdw's avatar

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's avatar

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's avatar
rumm.an
Best Answer
Level 17

@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's avatar

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

Please or to participate in this conversation.