tutorial on configuring LNMP under the Debian system, debianlnmp_php tutorial

Source: Internet
Author: User
Tags ubuntu vps

A tutorial on configuring LNMP under the Debian system, DEBIANLNMP


LNMP environment configuration is required to let our host support Nginx, MySQL, PHP, PhpMyAdmin, so configured to use this environment directly, and run the site on the above, I will configure the method.

We'll take a look at the official statement

LNMP One-click installation package is a Linux shell can be installed for Centos/radhat, Debian/ubuntu VPS (VDS) or standalone host installation Lnmp (Nginx, MySQL, PHP, PhpMyAdmin) Shell programs for production environments


1, install MySQL
Execute command:

Apt-get install-y Mysql-server mysql-client

Can install MySQL, the installation process will ask the root password, type the password you need after the return.

Once the installation is complete, perform one-step security settings as follows:

Mysql_secure_installation

Follow the prompts and ask if you want to change the root password, remove anonymous users, disable root login, and so on.
2, install PHP
Execute command:

Apt-get Install php5-fpm php5-gd php5-mysql php5-memcache php5-curl

The above command installs the Php5-memcache extension, and then continues to install the Memcached.

Apt-get Install memcached

Once the installation is complete, use php5-fpm-v to view the PHP version:

root@ztbox:~# php5-fpm-v

PHP 5.4.16-1~dotdeb.1 (fpm-fcgi) (Built:jun 8 2013 22:20:42)
Copyright (c) 1997-2013 the PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

3, install Nginx

Here I have installed all of the Nginx extensions (nginx-full) directly in order to deal with the functionality enhancements that may occur in the future.

Apt-get install-y Nginx-full

Then start the Nginx:

Service Nginx Start

Access results such as, next configure Nginx.

Vim/etc/nginx/sites-available/default

......
Location ~. php$ {
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;
Include Fastcgi_params;
}
......

After you save the changes, restart Nginx:

Service Nginx Restart

Next we create a new phpinfo to view PHP details:

vim/usr/share/nginx/html/phpinfo.php<?php phpinfo ();?>

After saving access to http://ip/phpinfo.php, if the Phpinfo page appears, you are done.

How to create a new site
and brother's one-button package, the LNMP installed by this method requires the site configuration file to be added manually.

Cd/etc/nginx/conf.d

Enter the profile directory and create a new site configuration file, such as

VI dearroy.com.confserver {  listen; #ipv6  #listen [::]:80 default_server;  root/usr/share/nginx/html/dearroy.com; #默认首页文件名  index index.php index.html index.htm; #绑定域名  server_name localhost; #伪静态规则 include wordpress.conf;  Location/{    try_files $uri $uri//index.html;      } #定义错误页面  #error_page 404/404.html;   Location ~. php$ {    fastcgi_split_path_info ^ (. +.php) (/.+) $;    Fastcgi_pass 127.0.0.1:9000;     Fastcgi_index index.php;     Include Fastcgi_params;   }   #PHP}

After saving, restart Nginx, add and bind the website is complete.

Finally, there are two most commonly used procedures Nginx pseudo-static:

Wordpress:

Copy the Code code as follows: Location/{
if (-f $request _filename/index.html) {
Rewrite (. *) $1/index.html break;
}
if (-f $request _filename/index.php) {
Rewrite (. *) $1/index.php;
}
if (!-f $request _filename) {
Rewrite (. *)/index.php;
}
}

Discuz X:

Copy the Code code as follows: Rewrite ^ ([^.] *)/topic-(. +). html$ $1/portal.php?mod=topic&topic=$2 last;
rewrite ^ ([^.] *)/article-([0-9]+)-([0-9]+). html$ $1/portal.php?mod=view&aid=$2&page=$3 last;
rewrite ^ ([^.] *)/forum-(w+)-([0-9]+). html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;
rewrite ^ ([^.] *)/thread-([0-9]+)-([0-9]+)-([0-9]+). html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3d$4&page= $ last;
rewrite ^ ([^.] *)/group-([0-9]+)-([0-9]+). html$ $1/forum.php?mod=group&fid=$2&page=$3 last;
rewrite ^ ([^.] *)/space-(USERNAME|UID)-(. +). html$ $1/home.php?mod=space&$2=$3 last;
rewrite ^ ([^.] *)/([a-z]+)-(. +). html$ $1/$2.php?rewrite=$3 last;
if (!-e $request _filename) {
return 404;

http://www.bkjia.com/PHPjc/1029602.html www.bkjia.com true http://www.bkjia.com/PHPjc/1029602.html techarticle in the Debian system Configuration Lnmp tutorial, DEBIANLNMP LNMP Environment configuration is required to let our host support Nginx, MySQL, PHP, phpMyAdmin, so configured so that you can directly use this ...

  • 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.