分享

YUM安装LNMP架构

 昵称50041816 2017-12-19

CentOS默认源里没有nginx软件 :wget http://www./installers/atomic

sh ./atomic #安装YUM源

yum check-update #更新yum软件包

一、安装nginx

yum install nginx service nginx start chkconfig nginx on

二、安装mysql

yum install mysql mysql-server mysql-devel service mysqld start chkconfig mysqld on

三、安装php

#安装PHP及组件,使PHP支持 MySQL、PHP支持FastCGI模式

yum install php php-mysql php-gd libjpeg* php-pear php-xml php-mbstring php-mcrypt php-mhash libmcrypt libmcrypt-devel php-imap php-ldap php-odbc php-bcmath php-xmlrpc php-fpm service mysqld restart service nginx restart service php-fpm start

四、配置nginx支持php

vi /etc/nginx/nginx.conf #修改运行用户 user nginx; vi /etc/nginx/conf.d/default.conf #开启php支持 index index.php index.html index.htm; location ~ \.php$ { root html; #取消FastCGI server部分location的注释 fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/$fastcgi_script_name; #$document_root设置为网站根目录 include fastcgi_params; }

1、配置php

date.timezone = Asia/Shanghai #设置时区 expose_php = OFF #禁止显示版本信息

2、配置php-fpm

vi /etc/php-fpm.d/www.conf user = nginx group = nginx

3、测试

chown -R nginx.nginx /usr/share/nginx/html/ #设置目录所有者 chmod 774 -R /usr/share/nginx/html/ #设置目录权限 service mysqld restart service nginx restart service php-fpm restart cd /usr/share/nginx/html/ vi index.php <?Php phpinfo();?>

http://127.0.0.1 #可以看到相关的配置信息!

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多