4

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?

0

2 Answers 2

5

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.

Sign up to request clarification or add additional context in comments.

4 Comments

I should not use port 8000 to access to project. I wana use standard 80
Good to hear it solved your problem; I have used it several times and it worked all the time!
I've followed as you mentioned in your tutorial but not working, can you help me what i have missing ?
You have which OS installed?
4

Create a virtual host configuration file at

/etc/apache2/sites-available

(Simply copy the default.conf file) and point the directory root to the folder containing your laravel project. Best is to copy your files to

/var/www/html/ ...project folder...

and make the public laravel dir document root in your confit file.

You can find more information on creating vhost files in many answers here on stackoverflow.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.