How to run Laravel project on Apache localhost


When I use artisan serve project works fine on localhost:8000 but I need to run project from localhost/, when I visit localhost/project/public code don't work correctly, any solution?

Best Solution

Are you using Linux? If you are, then I have instructions for you that should help both for the current project and the future projects:

The best approach is to create a virtual host for your project. For future projects, you will simply repeat the same process.

To save you time, I have put together a clear tutorial on how to do so by creating a conf file. This will enable you to access your project by actually visiting a local domain like demo.local instead of localhost:8000 etc.

Here is the tutorial : How to setup a virtual host in Ubuntu (Laravel Example)

I hope this helps and if you have further questions, please let me know.

Related Question