Ubuntu14.04 Build LNMP Platform

Source: Internet
Author: User
Tags fpm install php

Update Source:

Apt-get Install update

Close apache2:

/etc/init.d/apache2 stop

Install Nginx:

Apt-get Install Nginx

Install MySQL:

Apt-get install Mysql-server #连续输入两次相同密码, password for use with MySQL managed account

Install PHP:

Apt-get Install PHP5-FPM Php5-mysql

To configure PHP, modify the php.ini file:

Cp/etc/php5/fpm/php.ini/etc/php5/fpm/php.ini.back #备份php. ini file

Vim/etc/php5/fpm/php.ini

cgi.fix_pathinfo=0# Remove PathInfo mode with security implications

Start PHP-FPM

Service PHP5-FPM Restart

Configure Nginx to use the PHP5-FPM process

Cp/etc/nginx/sites-available/default/etc/nginx/sites-available/default.back

Vim/etc/nginx/sites-available/default

server {

Listen default_server;

Listen [::]:80 default_server Ipv6only=on;


root/usr/share/nginx/html;

Index index.html index.htm;


server_name localhost;


Location/{

# First attempt to serve request as file, then

# as Directory, then fall back to displaying a 404.

Try_files $uri $uri/= 404;

# Uncomment to enable Naxsi

# Include/etc/nginx/naxsi.rules

}

Error_page 502 503 504/50x.html;

Location =/50x.html {

root/usr/share/nginx/html;

}

Location ~ \.php$ {

# try_files $uri = 404;

Fastcgi_split_path_info ^ (. +\.php) (/.+) $;

# # Note:you should has "cgi.fix_pathinfo = 0;" In php.ini

#

# # with php5-cgi alone:

# Fastcgi_pass 127.0.0.1:9000;

# with PHP5-FPM:

Fastcgi_pass Unix:/var/run/php5-fpm.sock;

Fastcgi_index index.php;

# Fatcgi_param Scritp_filename $document _root$fastcgi_script_name;

Include Fastcgi_params;

}

}

Restart Nginx Service:

Service Nginx Restart

To establish a info.php test file:

vim/usr/share/nginx/html/info.php

<?php

Phpinfo ();

?>

Browser testing:

http://IP/info.php


Upload the original PHP Web page file to the/usr/share/nginx/html/directory


Ubuntu14.04 Build LNMP Platform

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.