Construction of LNMP Environment under CentOS

Source: Internet
Author: User

1. Configure the third-party yum source for CentOS because the original Yum is unable to install Nginx

wget http://www.atomicorp.com/installers/atomic Download Atomic yum source

Sh./atomic performing the installation

Yum Check-update

2. Installing Nginx

Yum Install Nginx

Service Nginx Start

Chkconfig Nginx on

3. Install MySQL

Yum install MySQL Mysql-server

Service mysqld Start

Chkconfig mysqld on

4. Installing PHP and its related components

Yum install php-mysql Php-redis php-devel php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbst Ring Php-mcrypt php-bcmath php-mhash libmcrypt libmcrypt-devel php-fpm php

Service PHP-FPM Start

Chkconfig PHP-FPM on

5. Modify the relevant configuration to enable Nginx support PHP

Vi/etc/nginx/conf.d/default.conf

Remove the previous comment

Location ~ \.php$ {
root HTML;
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Fastcgi_param script_filename $document _root$fastcgi _script_name; #注意这里需要修改为$document _root
Include Fastcgi_params;
}

Then restart Nginx,service nginx restart
Now it's ready to support PHP.

6. Whether the test environment is built successfully

Create a new index.php file under/usr/share/nginx/html path

<?php

Phpinfo ();

?>

Access Address # # # (IP address or bound domain name)/index.php

If this is displayed, it proves that it has been configured successfully.

Construction of LNMP Environment under CentOS

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.