Centos 6.4下yum安装简单实现LNMP架构

分类:CentOS运维 阅读:40882 次

一、安装版本

nginx 1.6.3

pcre-devel 7.8-6

mysql 5.1.73

php 5.3.3

二、安装需要的包

[root@localhost ~]#yum -y install lrzsz

[root@localhost ~]#yum -y install gcc pcre-devel zlib zlib-devel

编译安装nginx

[root@localhost ~]#./configure --prefix=/usr/local/nginx

[root@localhost ~]#make && make install

启动nginx

[root@localhost ~]#/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

安装mysql

[root@localhost ~]#yum -y install mysql mysql-server mysql-devel

[root@localhost ~]#/etc/init.d/mysqld start

安装php

[root@localhost ~]#yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml

[root@localhost ~]#yum install php-fpm

[root@localhost ~]#/etc/init.d/php-fpm start

配置nginx支持php

[root@localhost conf]# cat /usr/local/nginx/html/index.php

<?php

phpinfo();

?>

[root@localhost conf]#vi /usr/local/nginx/conf/nginx.conf

location ~ \.php$ {

root html;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html/$fastcgi_script_name;

include fastcgi_params;

}

重启nginx

/usr/local/nginx/sbin/nginx -s reload

三、访问域名测试

http://www.webtest.com/index.php

Centos 6.4下yum安装简单实现LNMP架构