yum 快速搭建LNMP 环境

关闭默认的 httpd 服务

service httpd stop
chkconfig httpd off

安装 Nginx 支持

rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm

安装 php 支持

yum -y install php php-fpm php-gd php-mysql php-mbstring php-xml php-mcrypt mysql mysql-server nginx

启动 php 服务

service php-fpm start

nginx 配置

location / {
    root {你的php 文件目录};
    //root /usr/share/nginx/html;
    index index.html index.htm index.php;
}

location ~ \.php$ {
    root {你的php 文件目录};
    //root /usr/share/nginx/html;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
}

你可能感兴趣的:(yum 快速搭建LNMP 环境)