Laravel:Installasi: Difference between revisions

Created page with "Let's first install a webserver to host the Laravel application. You can either use Apache or Nginx web server. Here I am using an Apache web server. To install apache2, type: <syntaxhighlight lang="bash"> sudo apt install apache2 </syntaxhighlight> Once installed, Apache should be running. If it's not, for whatever reason, start it: <syntaxhighlight lang="bash"> sudo systemctl start apache2 </syntaxhighlight> Then enable it to start on boot time. <syntaxhighlight..."
 
 
(2 intermediate revisions by the same user not shown)
Line 121: Line 121:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
sudo composer create-project laravel/laravel laravelapp
sudo composer create-project laravel/laravel laravelapp
</syntaxhighlight>
Or, you may create new Laravel projects by globally installing the Laravel installer via Composer:
<syntaxhighlight lang="bash">
composer global require laravel/installer
</syntaxhighlight>
<syntaxhighlight lang="bash">
laravel new example-app
</syntaxhighlight>
</syntaxhighlight>


Line 158: Line 168:
Next, past the content shown and replace the example.com ServerName directive with the FQDN or public IP of the server ( Or private IP in case the server is on a LAN network ).
Next, past the content shown and replace the example.com ServerName directive with the FQDN or public IP of the server ( Or private IP in case the server is on a LAN network ).


<syntaxhighlight lang="bash">
<syntaxhighlight lang="apacheconf" line="1">
<VirtualHost *:80>
<VirtualHost *:80>
ServerName example.com
    ServerName example.com
ServerAdmin admin@example.com
    ServerAdmin admin@example.com
DocumentRoot /var/www/html/laravelapp/public
    DocumentRoot /var/www/html/laravelapp/public
<Directory /var/www/html/laravelapp>
 
AllowOverride All
    <Directory /var/www/html/laravelapp>
</Directory>
        AllowOverride All
ErrorLog ${APACHE_LOG_DIR}/error.log
    </Directory>
CustomLog ${APACHE_LOG_DIR}/access.log combined
 
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
</VirtualHost>
</syntaxhighlight>
</syntaxhighlight>
Line 189: Line 201:
==Source==
==Source==
*[https://linuxopsys.com/topics/install-laravel-on-ubuntu-20-04 linuxopsys.com]
*[https://linuxopsys.com/topics/install-laravel-on-ubuntu-20-04 linuxopsys.com]
[[Category:Laravel]]
[[Category:Website]]
[[Category:Web Server]]
[[Category:Framework]]
[[Category:PHP]]
[[Category:Apache]]