Yum quickly builds LNMP environment

Source: Internet
Author: User

1. Turn off the firewall

[Email protected] ~]# chkconfig iptables off

2. Turn off selinux

Vi/etc/sysconfig/selinux

Modify selinux=enforcing to disabled and then restart to take effect

3.Configure CentOS 6.0 third-party Yum Source (no Nginx package in CentOS default standard source )

download wget Tools

[email protected] ~]# Yum install wget

download atomic yum source

[Email protected] ~]# wgethttp://www.atomicorp.com/installers/atomic

[Email protected] ~]# sh./atomic

Enter Yes when prompted for installation

# Update yum package

[email protected] ~]# Yum check-update

4. Install the package and library files

[[email protected] ~]# yum-y install NTP makeopenssl openssl-devel pcre pcre-devel libpng libpng-devel libjpeg-6blibjpeg- devel-6b freetype freetype-devel gd gd-devel zlib zlib-devel gccgcc-c++ libxpm libxpm-devel ncurses ncurses-devel libmcryp T libmcrypt-devellibxml2 libxml2-devel imake autoconf automake screen sysstatcompat-libstdc++-33 Curl Curl-devel

5. Uninstall the installed Apache,MySQL,php

[email protected] ~]# Yum List installed |grepmysql,httpd,php

[email protected] ~]# Yum Remove mysql*

[email protected] ~]# Yum Remove httpd

[[email protected] ~]# Yum remove php

6. Installing Nginx

[[email protected] ~]# Yum install Nginx

[[Email protected] ~]# service Nginx start

set 2,3,5 level boot

[Email protected] ~]# chkconfig--levels 235nginx on

7. Install MySQL

[email protected] ~]# Yum install mysqlmysql-server mysql-devel

[[Email protected] ~]# service mysqld start

[Email protected] ~]# chkconfig--levels 235mysqld on

to set a password for the root user

[Email protected] ~]# mysqladmin-u Rootpassword "123456"

Restart MySQL

[Email protected] ~]# service mysqld restart

8. Install PHP

[email protected] ~]# Yum install phplighttpd-fastcgi php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pearphp-xml Php-xmlrpc php-mbstring php-mcrypt php-mssql php-snmp php-soap php-tidyphp-common php-devel php-fpm

Install PHP and the required components to enable PHP to support MySQL,FastCGI mode

[[Email protected] ~]# service PHP-FPM start

[Email protected] ~]# Chkconfig--levels 235 Php-fpmon

9. Configure nginx support PHP

[Email protected] ~]# Mv/etc/nginx/nginx.conf/etc/nginx/nginx.confbak

change the configuration file to a backup file

[Email protected] ~]# cp/etc/nginx/nginx.conf.default/etc/nginx/nginx.conf

since the original profile is going to be written by itself, you can use the default configuration file as the profile

Modify nginx configuration file, add fastcgi support

[Email protected] ~]# 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/usr/share/nginx/html $fastcgi _script_name;

Include Fastcgi_params;

}

Remove the above code comments and modify the default path to Nginx

Configure PHP

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

[Email protected] ~]# Vi/etc/php.ini

One. restart Nginx php-fpm

[[Email protected] ~]# service Nginx restart

[Email protected] ~]# service PHP-FPM restarts

Create a info.php file

[Email protected] ~]# vi/usr/share/nginx/html/info.php


This article from "Yun Vil Szeng" blog, declined reprint!

Yum quickly builds LNMP environment

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.