Install the Backend Components
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install nginx git php7.3-fpm php7.3-mysql php7.3-mcrypt
Modify the PHP Configuration
sudo nano /etc/php/7.3/fpm/php.ini
Mudar a linha que tem:
;cgi.fix_pathinfo=1
para
cgi.fix_pathinfo=0
sudo service php7.3-fpm restart
Configure Nginx and the Web Root
sudo mkdir -p /var/www/laravel
sudo nano /etc/nginx/sites-available/default
Deve ficar assim:
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/laravel/public;
index index.php index.html index.htm;
server_name server_domain_or_IP;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Depois sai do arquivo e executa:
sudo service nginx restart
Install Composer and Laravel
cd ~
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
sudo composer create-project laravel/laravel /var/www/laravel
sudo composer create-project laravel/laravel /var/www/laravel 5.8
sudo chown -R :www-data /var/www/laravel
sudo chmod -R 775 /var/www/laravel/storage
http://server_domain_or_IP
Link de referência: https://www.digitalocean.com/community/tutorials/how-to-install-laravel-with-an-nginx-web-server-on-ubuntu-14-04