Installing Laravel 5.5 & MySQL in Ubuntu 16.04 with Nginix already installed

Here are my notes on how to install these components.

sudo apt-get install php7.0-mbstring php7.0-xml composer unzip
sudo apt-get install -y php7.0 php7.0-fpm php7.0-mysql php7.0-zip php7.0-gd
sudo apt-get install mcrypt php7.0-mcrypt
sudo apt-get install -y php7.0-mbstring php7.0-xml –force-yes
sudo apt-get install php7.0-curl php7.0-json
sudo vi /etc/php/7.0/fpm/php.ini
    cgi.fix_pathinfo=0
sudo service php7.0-fpm restart
sudo mkdir -p /var/www/laravel
sudo vi /etc/nginx/sites-available/default
server {
        listen 80;
        listen [::]:80 ipv6only=on;

        root /var/www/laravel/public;
        index index.php index.html index.htm;

        # Make site accessible from http://localhost/
        server_name <serverName>;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ /index.php?$query_string;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules
        }
        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }
}
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 chown -R :www-data /var/www/laravel
sudo chmod -R 775 /var/www/laravel/storage
sudo chmod -R guo+w storage
sudo apt-get update
sudo apt-get install mysql-server
sudo mysql_secure_installation

Leave a Reply