Centos6.5 Installation LNMP Environment

Source: Internet
Author: User

The recent project to be configured on Nginx, so search for the installation of specific nginx, see this article concise and test success on borrowed, works Source: http://www.cnblogs.com/xiaoit/p/3991037.html Author nickname: Eisenhower

Reprint please indicate the source, respect the author's labor results, and thank the author's selfless sharing, thank you!

1: View the Environment:

1 2 [[email protected]]# cat /etc/redhat-releaseCentOS release 6.5 (Final)

2: Turn off the firewall

1 2 [[email protected]]# service iptables stop[[email protected]]# chkconfig iptables off

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

1 #wget http://www.atomicorp.com/installers/atomic
1 #sh ./atomic
1 #yum check-update

4: Install the bundle and library files

1 2 3 4 #yum -y install ntp make openssl openssl-devel pcre pcre-devel libpng libpng-devel libjpeg-6b libjpeg-devel-6b freetype freetype-devel gd gd-devel zlib zlib-devel gcc gcc-c++ libXpm libXpm-devel ncurses ncurses-devel libmcrypt libmcrypt-devel libxml2 libxml2-devel imake autoconf automake screen sysstat compat-libstdc++-33 curl curl-devel

5: Uninstall the installed Apache, MySQL, PHP

1 2 3 # yum remove httpd# yum remove mysql# yum remove php

6: Install Nginx

1 2 3 4 # yum install nginx# service nginx start# chkconfig --levels 235 nginx on//设2、3、5级别开机启动

7: Install MySQL

1 2 3 # yum install mysql mysql-server mysql-devel# service mysqld start# chkconfig --levels 235 mysqld on
1 2 3 4 5 6 7 8 登陆MySQL删除空用户,修改root密码mysql>select user,host,password from mysql.user; mysql>drop user ‘‘@localhost; mysql>update mysql.user set password = PASSWORD(‘*********‘) where user=‘root‘; mysql>flush privileges;

  

8: Install PHP

12 # yum install php lighttpd-fastcgi php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-mssql php-snmp php-soap

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

1 #yum install  php-tidy php-common php-devel php-fpm php-mysql
1 2 # service php-fpm start# chkconfig --levels 235 php-fpm on

9: Configure Nginx support PHP

1 2 3 4 5 6 7 8 9 Ten One A - - the - - - + # mv /etc/nginx/nginx.conf /etc/nginx/nginx.confbak//将配置文件改为备份文件 # cp /etc/nginx/nginx.conf.default /etc/nginx/nginx.conf//由于原配置文件要自己去写因此可以使用默认的配置文件作为配置文件 //修改nginx配置文件,添加fastcgi支持# vi /etc/nginx/nginx.confindex index.php index.html index.htm;//加入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;        }//将以上代码注释去掉,并修改成nginx默认路径

  

1

10: Configure PHP

12 //编辑文件php.ini,在文件末尾添加cgi.fix_pathinfo = 0(原作者这里设置的1,没明白为什么,我查了下别人说设置为1时会引起nginx文件类型解析错误漏洞,建议设置为0)[[email protected] ~]# vi /etc/php.ini

11: Restart Nginx php-fpm

1 2 # service nginx restart# service php-fpm restart

  

12: Build info.php File

1 2 3 4 # vi /usr/share/nginx/html/info.php<?php   phpinfo();?>

  

13: Test Nginx parsing PHP

1 2 本地浏览器输入:192.168.175.130/info.php显示php界面  环境搭建成功

Centos6.5 Installation 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.