I have started working in laravel and using lampp. I have watched many tutorials that use a vhost to make user-friendly url. I want to do it on Ubuntu 16.04.
Following tutorial is not working for me:
https://ourcodeworld.com/articles/read/302/how-to-setup-a-virtual-host-locally-with-xampp-in-ubuntu
<VirtualHost *:80>
DocumentRoot "/opt/lampp/htdocs/basicwebsite/public"
ServerName mywebsite.dev
</VirtualHost>
I think you also need to add a host in
/etc/hosts
. Open the hosts file and add this line:You will need to restart server after this.
Setup a virtual host for a Laravel project
assuming that the Laravel project is in /var/www/html/
so now the file will look something like this:
save and close.
add this line:
save and close.
open the project folder
this will serve on port 8000 by default
you can also specify the port
or any other specified port.
Source.
Its not working because the browsers have updated their security terms and policies including SSL certificates over
.dev
domains. just change your extension from.dev
to something else like.localhost
or.test
.Also change the extension in
/etc/hosts
from.dev
to.test
.Also keep in mind to restart the service to load the new added virtual host i.e: restart the Apache server
Hope it helps.
1.Create new file under this path /etc/apache2/sites-available/myweb.conf
2.Copy the following to the file
3.Run "sudo a2ensite myweb.conf"
4.Add this line "Listen 80" to file "/etc/apache2/ports.conf"
5.Restart apache server