简体   繁体   中英

php artisan serve command works but url not working

In Laravel 5.4,

After running php artisan serve command fresh laravel setup works on this url localhost:8000 but when i try to access with public url localhost/lara54/public . it is not working and gives white blank page. I tried this using virtual host in linux giving folder path upto public but still not working.

php artisan serve command also creates a virtual host what i am missing here to make this setup work with URL.

give permission to following two directories:

storage

bootstrap/cache

i hope its help you

Try using the following --port param:

php artisan serve --port=8000

Hope it helps you because this solves my problem.

运行此命令它将起作用

php -S 0.0.0.0:8000

Default laravel command "php artisan server" return url "localhost:8000" in your browser url, you should type " http://localhost:8000 ". Because it's use default PHP built in Web Server (read at PHP.net ) to serve Laravel Application Direcory for Development.

for production, it recommend use Nginx or Apache, you may read On DigitalOcean for Nginx or for Apache

尝试安装 vc 运行时为我工作

I just got inspired by user4535674 's and Bercove 's answers.

Instead of php artisan serve --port=8000 type php artisan serve --host=0.0.0.0 --port=8000

It worked in my case like a charm!

It's a matter of fact that serve command and run with public folder give url not found error. There are three ways

  1. you should change your url like this:

  2. you should change your .htaccess file and add code

    <Directory /var/www/html/public/> Options Indexes FollowSymLinks AllowOverride All Require all granted

  3. on production server you should run VC

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM