Skip to content

Instantly share code, notes, and snippets.

@lamngockhuong
Created February 27, 2018 07:03
Show Gist options
  • Select an option

  • Save lamngockhuong/623c60ea1d9f3a667db923736d23c422 to your computer and use it in GitHub Desktop.

Select an option

Save lamngockhuong/623c60ea1d9f3a667db923736d23c422 to your computer and use it in GitHub Desktop.
[Deploy Laravel application on ubuntu with apache2] #laravel #ubuntu #apache2

Create conf file for virtual domain

sudo nano /etc/apache2/sites-available/laravel.conf

Then copy and paste the content below into the file and save it:

<VirtualHost *:80>   
  ServerAdmin [email protected]
     DocumentRoot /var/www/laravel/public
     ServerName example.com
     ServerAlias www.example.com

     <Directory /var/www/laravel/>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

laravel is application directory.

Enable the laravel and rewrite module

sudo a2ensite laravel.conf
sudo a2enmod rewrite

Restart apache2

sudo service apache2 restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment