Detailed steps for Yum to build LNMP environment

Source: Internet
Author: User
Tags curl fpm install php openssl centos

1. Close the firewall

[Root@centos ~]# chkconfig iptables off

2. Close SELinux

Vi/etc/sysconfig/selinux

Modify the selinux=enforcing to disabled and restart the active

3, configure CentOS 6.0 third party yum source (centos default standard source does not have Nginx package)

Download the Wget tool

[Root@centos ~]# Yum Install wget

Download Atomic Yum Source

[Root@centos ~]# wget http://www.atomicorp.com/installers/atomic

[Root@centos ~]# Sh./atomic

When the installation prompts you to enter, you lose Yes

#更新yum软件包

[Root@centos ~]# Yum Check-update

4. Installation of the open contract and library files

[Root@centos ~]# yum-y install NTP make OpenSSL openssl-devel pcre pcre-devel libpng libpng-devel libjpeg-6b l-6b freetype freetype-devel gd gd-devel zlib zlib-devel gcc gcc-c++ libxpm libxpm-devel ncurses ncurses-devel libmcrypt L Ibmcrypt-devel libxml2 libxml2-devel imake autoconf automake screen sysstat compat-libstdc++-33 Curl Curl-devel

5. Uninstall the installed Apache, MySQL, PHP

[Root@centos ~]# Yum Remove httpd

[Root@centos ~]# yum Remove MySQL

[Root@centos ~]# Yum Remove php

6. Install Nginx

[Root@centos ~]# Yum Install Nginx

[Root@centos ~]# service Nginx start

Set 2, 3, 5 level do not boot

[Root@centos ~]# chkconfig--levels 235 nginx on

7. Install MySQL

[Root@centos ~]# yum install MySQL mysql-server mysql-devel

[Root@centos ~]# Service mysqld start

[Root@centos ~]# chkconfig--levels 235 mysqld on

Set a password for the root user

[Root@centos ~]# mysqladmin-u root password "123456"

Restart MySQL

[Root@centos ~]# Service mysqld Restart

8. Install PHP

[Root@centos ~]# yum install php lighttpd-fastcgi php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pear php -xmlrpc php-mbstring php-mcrypt php-mssql php-snmp php-soap php-tidy php-common php-devel php-fpm

Install PHP and required components to enable PHP to support MySQL, fastcgi mode

[Root@centos ~]# Service php-fpm start

[Root@centos ~]# chkconfig--levels 235 php-fpm on

9. Configure Nginx to support PHP

[Root@centos ~]# Mv/etc/nginx/nginx.conf/etc/nginx/nginx.confbak

Change configuration file to backup file

[Root@centos ~]# cp/etc/nginx/nginx.conf.default/etc/nginx/nginx.conf

Because the original profile has to be written on its own, you can use the default profile as a configuration file

Modify Nginx configuration file, add fastcgi support

[Root@centos ~]# vi/etc/nginx/nginx.conf

Index index.php index.html index.htm;

Join index.php

Location ~ \.php$ {

root/usr/share/nginx/html;

Fastcgi_pass 127.0.0.1:9000;

Fastcgi_index index.php;

Fastcgi_param Script_filename/www$fastcgi_script_name;

Include Fastcgi_params;

}

Remove the above code comment and modify it to nginx default path note Fastcgi_param script_filename/www$fastcgi_script_name www should be replaced with the actual PHP hosting directory

10. Configure PHP

Edit file php.ini, add Cgi.fix_pathinfo = 1 at end of file

[Root@centos ~]# Vi/etc/php.ini

11. Restart Nginx PHP-FPM

[Root@centos ~]# Service Nginx Restart

[Root@centos ~]# Service php-fpm restart

12. Establishment of info.php documents

[Root@centos ~]# vi/usr/share/nginx/html/info.php

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.