It's actually quite easy
This one is for nginX https://www.howtoforge.com/tutorial/ubuntu-laravel-php-nginx/
And this one for Apache https://www.howtoforge.com/tutorial/install-laravel-on-ubuntu-for-apache/
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
what am i using:
ubuntu0.18.04.2 PHP Version 7.2.24-0
site location: /var/www/vhosts/maindomain/subdomain/laravelproject
what did I do to install laravel
sudo apt-get upgrade
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install apache2 libapache2-mod-php7.2 php7.2 php7.2-xml php7.2-gd php7.2-opcache php7.2-mbstring
cd /tmp
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
cd /var/www/vhosts/maindomain/subdomain/
sudo composer create-project laravel/laravel laravel --prefer-dist
sudo chgrp -R www-data ./laravel
sudo chmod -R 775 ./laravel/storage
cd /etc/apache2/sites-available
nano laravel.conf
the laravel.conf
"<VirtualHost *:80>
ServerName subdomainname.nl
DocumentRoot "/var/www/vhosts/domainname.nl/subdomainname/laravel"
<Directory /var/www/vhosts/domainname.nl/subdomainname/laravel>
DirectoryIndex index.php
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
"
sudo a2dissite 000-default.conf
sudo a2ensite laravel.conf
sudo a2enmod rewrite
sudo service apache2 restart
cd /var/www/vhosts/domainname.nl/subdomainname/laravel
nano .htaccess
the .htaccess file:
"
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ / [L,R=301]
RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.gif|robots\.txt)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(css|js|images)/(.*)$ public// [L,NC]
RewriteRule ^\.env$ - [R=404,L,NC]
"
sudo find laravel/ -type f -exec chmod 644 {} ;
sudo find laravel/ -type d -exec chmod 775 {} ;
Question: Where do I go wrong!!!!
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
Please or to participate in this conversation.