Quick note, be sure to change the sites name test
to the name of your app
sudo apt update
sudo apt upgrade
sudo apt install mysql-server
sudo apt install nginx
sudo apt install php-fpm php-myql php-mbstring php-zip php-xml
/etc/php/7.0/fpm
sudo vi php.ini
cgi.fix_pathinfo=0
sudo apt install composer
composer global require "laravel/installer"
sudo vi ~/.profile
append $HOME/.config/composer/vendor/bin
to your $PATH variable
PATH="$HOME/bin:$HOME/.local/bin:$PATH:$HOME/.config/composer/vendor/bin"
Go to the directory where you want to store the site e.g. /var/www/html
and type the following commands to create the Laravel project directory
laravel new test
cd test
cp .env.example .env
php artisan key:generate
You also need to configure the proper directory permissions
cd /var/www/html/
sudo chown -R -v yourusername:www-data test
chmod -R -v 750 test
cd test
chmod 770 storage
chmod 770 bootstrap/cache
Make a new configuration file
cd /etc/nginx/sites-available
sudo cp default test
sudo vi test
Change the following lines
root "/var/www/html/test/public"
index index.html index.htm index.nginx-debian.html index.php;
server_name test.app www.test.app
try_files $uri $uri/ /index.php?$query_string;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php7.0-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php7.0-fpm:
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
Enable the site
sudo ln -s /etc/nginx/sites-available/test /etc/nginx/sites-enabled/test
and if the default sites is still enabled
sudo rm /etc/nginx/sites-enabled/default
and restart the server
sudo service nginx restart