Laravel Project Configuration & Create Virtual Host:
Step 1: Create new laravel project with composer.
Step 2: We can start the project using the "php artisan serve" command. But often we do not have to turn on the command, so we will set up a virtual host.
Using sudo command open the below file. The file will be open as shown below.
Step 3: Must add the domain name related to the project.
Step 4: We will create a file to attach the project to the domain in below folder. And save with such name "blog.conf".
Step 5: Now, enable the configuration file with the following command:
sudo a2ensite blog.conf
Step 1: Create new laravel project with composer.
php composer.phar create-project --prefer-dist laravel/laravel blog "5.5.*"Step 2: We can start the project using the "php artisan serve" command. But often we do not have to turn on the command, so we will set up a virtual host.
Using sudo command open the below file. The file will be open as shown below.
sudo nano /etc/hostsStep 3: Must add the domain name related to the project.
127.0.1.1 blog.localStep 4: We will create a file to attach the project to the domain in below folder. And save with such name "blog.conf".
cd /etc/apache2/sites-available/
<VirtualHost *:80>
ServerAdmin admin@admin.com
ServerName blog.local
ServerAlias blog.local
DocumentRoot /var/www/html/blog/public/
<Directory /var/www/html/blog/public/>
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
# ErrorLog /var/log/apache2/your_domain.com-error_log
# CustomLog /var/log/apache2/your_domain.com-access_log
</VirtualHost>
Step 5: Now, enable the configuration file with the following command:
sudo a2ensite blog.conf
output
Enabling site blog.
To activate the new configuration, you need to run:
service apache2 reload
Step 6: Finally we restart apache server.
sudo service apache2 reloadStep 7: Enjoy the project in browser.
blog.local
Comments
Post a Comment