php - The laravel project is not working in "http://localhost/public/" the page says "This page isn’t working"
Get the solution ↓↓↓Solution:
You need to config a server as stated in the Laravel documentation/ web server configuration.
If you want to config apache as your server you should add following lines in the/etc/apache2/site-available/000-default.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /home/{user}/{project_root}/public
ServerName example.local
ServerAlias www.example.local
<Directory /home/{user}/{project_root}/public/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/example_error.log
CustomLog ${APACHE_LOG_DIR}/example_access.log combined
</VirtualHost>
Insert your user name in the{user}
and your desired domain in the{example}
.
Then, runsudo a2enmod rewrite
andsudo systemctl restart apache2
.
After that, add an ip in the/etc/hosts
to your desired domain like below:
127.0.0.1 example.local
Answer
Solution:
Localhost give access to your
htdocs
folder (if using xamp)www
folder (is using wamp)
You need to add project name also in your url
Example:
http://localhost/<project_name>/public
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: cannot add or update a child row: a foreign key constraint fails
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.