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>
Setup a virtual host for a Laravel project
$sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/myVhost
$sudo nano /etc/apache2/sites-available/myVhost.conf
assuming that the Laravel project is in /var/www/html/
ServerAdmin webmaster@localhost
serverName www.myAwesomeLink.com
DocumentRoot /var/www/html/laravel-app/public
<Directory /var/www/html/laravel-app>
AllowOverride All
</Directory>
so now the file will look something like this:
save and close.
$sudo nano /etc/hosts
add this line:
127.0.0.1 www.myAwesomeLink.com
save and close.
$sudo a2enmod rewrite
$sudo a2ensite myVhost.conf
$sudo service apache2 restart
open the project folder
php artisan serve
this will serve on port 8000 by default
you can also specify the port
php artisan serve --port=4200
or any other specified port.