Ubuntu 16.04 LTS installation nginx/php 5.6/mysql 5.7 (LNMP) with Laravel

Source: Internet
Author: User
Tags fpm

Ubuntu 16.04 LTS installation nginx/php 5.6/mysql 5.7 (LNMP) with Laravel

1, MySQL Installation "Install MariaDB"
MARIADB is a branch of MySQL
First, update the upgrade system
$ sudo apt update
$ sudo apt upgrade
Install MARIADB:
$ sudo apt install mariadb-server
To start the MARIADB service:
$ sudo systemctl start MySQL
$ sudo systemctl enable MySQL
View Status:
$ sudo systemctl status MySQL


For example, to improve the security of MARIADB, we can execute the initialization security script:
$ sudo mysql_secure_installation
The default root password is empty, then the root password and other options are set:
-Set root password? [y/n] Y
-Remove anonymous users? [y/n] Y
-Disallow root login remotely? [y/n] Y
-Remove test database and access to it? [y/n] Y
-Reload privilege tables now? [y/n] Y
Login mariadb command line:
$ sudo mysql-u root-p


2, Installation php5.6
Ubuntu 16.04 Default provides is php7.0, version is too high, I want to test Laravel, need 5.6 version of PHP
The implementation method is as follows:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php5.6
"Need to install some additional extension such as: Php5.6-gd php5.6-mbstring php5.6-mysql php5.6-zip php5.6-xml php5.6-mcrypt" "fpm??? 】

3. Installing Nginx
If Apache2 is installed, first uninstall and then install Nginx
Service Apache2 Stop
Update-rc.d-f apache2 Remove
Apt-get Remove Apache2

Install Ngnix "The installation process does not automatically create the directory and needs to be created manually such as/var/www/html"
Apt-get Install Ngnix
Service Ngnix Start

Browser Browse to verify that the installation was successful, the following page shows that the installation was successful

4, Configuration Ngnix

server {
Listen default_server;
Listen [::]:80 default_server;
Root/var/www/html/blogtest/public;
Index index.html index.php index.htm index.nginx-debian.html;

server_name 207.154.192.158;

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;
}

Location ~ \.php$ {
Try_files $uri/index.php = 404;
Fastcgi_split_path_info ^ (. +\.php) (/.+) $;
Fastcgi_pass Unix:/run/php/php5.6-fpm.sock;
Fastcgi_index index.php;
Fastcgi_param script_filename $document _root$fastcgi_script_name
;
Include Fastcgi_params;
}
}
--------------------------
Restart Ngnix:
Service Ngnix Restart

==================================================================
5, installation of Laravel and new projects
Apt-get Install composer
Composer global require "Laravel/installer"

In the/var/www/html
Composer Create-project--prefer-dist Laravel/laravel blogtest

To modify the file owner:
Chown-r Www-data:www-data blogtest/

6. Browser access

Ubuntu 16.04 LTS installation nginx/php 5.6/mysql 5.7 (LNMP) and Laravel

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.