Centos 6.4 简单实现LNMP架构

一、安装版本

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


wKiom1VkKZvQfSbXAAc0R3f7U9A290.jpg

你可能感兴趣的:(centos,架构,LNMP)