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;
}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容