I've use php artisan serve command the project has loaded successfully in laravel 5.2
but if i load http://localhost/projectname/public/ it has shown blank white page.
How can I run my laravel 5.2 app using http://localhost/mydemo/public/ this url
You should set up your web server so public
directory would be set up as root directory.
For example, you're using Apache, you should do something like this:
<VirtualHost *:80>
ServerName myapp.localhost.com
DocumentRoot "/home/vagrant/projects/myapp/public"
<Directory "/home/vagrant/projects/myapp/public">
AllowOverride all
</Directory>
</VirtualHost>
And don't forget to restart your web server after you do this.
Try running the PHP built-in sever directly from your public directory. You can check the PHP doc page for more details, but you should be able to cd into your mydemo/public
directory and run php -S localhost:8000
. Then open localhost:8000
in your browser to view the page. If you haven't made any changes to your routes.php
file, then the default Laravel welcome page should display.
If that doesn't work, I recommend watching the episode 1 and 2 of the latest Laravel From Scratch series on Laracasts. Jeffrey walks you through all of the setup and uses 'php artisan serve' early in episode 2 to load the built-in server.