ubuntu16.04 mounting Lnmp (ubuntu+nginx+mysql+php7.0)

Source: Internet
Author: User
Tags fpm install php

System Environment:

Ubuntu 16.04.2 LTS

nginx version:nginx/1.10.3 (Ubuntu)

PHP 7.0.22-0ubuntu0.16.04.1

MySQL Ver 14.14 Distrib 5.7.20

first, the environment preparation:

Detecting network environments

PING-C2 baidu.com

Update apt Source

sudo apt update

Second, install Nginx

1. Installing Nginx

sudo apt-get install nginx-y

2. Edit the configuration nginx file

sudo vim/etc/nginx/sites-available/default

#index行添加index. php

Index index.php index.html index.htm index.nginx-debian.html;

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

third, installation php7.0

1. Install PHP php-fpm

$sudo apt-get Install php7.0 php7.0-fpm-y

2. Edit the configuration file php.ini, locate cgi.fix_pathinfo=0, and change the value to 1

$sudo Vim/etc/php/7.0/fpm/php.ini

760 cgi.fix_pathinfo=0

3. Restart the service

$sudo systemctl Restart Nginx php7.0-fpm

iv. installation of MySQL

$sudo apt Install mysql-server mysql-client libmysqld-dev-y

Follow the prompts to enter the root user password

$sudo Apt install-y php7.0-mysql

v. Verification

$echo "<?php phpinfo ();? > ">/var/www/html/index.php

Browser Access http://localhost

ubuntu16.04 Installing LNMP (ubuntu+nginx+mysql+php7.0)

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.