Article


Laravel 5.8 Install virtualhost (Linux Ubuntu)

$ cd /var/www/

$ composer create-project --prefer-dist laravel/laravel bengkel.dev "5.8.*"
$ cd bengkel.dev

# Setup Virtual Host di Ubuntu 16.04
# Memberikan Izin Pada direktory

$ sudo chown -R $USER:$USER /var/www/bengkel.dev/
$ sudo chown -R www-data:www-data ./vendor
$ sudo chown -R www-data:www-data ./storage
$ sudo chown www-data:www-data -R /var/www/bengkel.dev

$ sudo usermod -a -G www-data yussaq
$ sudo chmod -R 775 /var/www/bengkel.dev/storage


# Membuat File VirtualHost yang Baru
$ sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/bengkel.dev.conf
$ sudo nano /etc/apache2/sites-available/bengkel.dev.conf


    #ServerName www.example.com
    ServerAdmin laravel@localhost
    ServerName bengkel.dev
    ServerAlias bengkel.dev
        DocumentRoot /var/www/bengkel.dev/public
                Options FollowSymLinks
                AllowOverride All
                Require all granted    
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Require all granted
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

# Aktivasi Virtual Host
$ sudo a2ensite bengkel.dev.conf

# merestart Apache
$ sudo service apache2 reload

# Setting Local Hosts File
$ sudo nano /etc/hosts

tambahkan alamat web baru
127.0.0.1 bengkel.dev

#Test Hasil Virtual Host 
http://bengkel.dev

jika The requested URL was not found on this server.

mengaktifkan modul mod_rewrite pada Apache2.

$ sudo a2enmod rewrite

ERROR: Declaration of Symfony\Component\Translation\TranslatorInterface::setLocale($locale) must be compatible with Symfony\Contracts\Translation\LocaleAwareInterface: 
SOLUTION :  add require-dev at composer.json
            "symfony/translation-contracts": "^1.1.6"

            $composer update

Posted in Laravel, Linux on Mar 26, 2020