码迷,mamicode.com
首页 > 其他好文 > 详细

快速部署一个LNMP

时间:2017-08-22 21:57:42      阅读:123      评论:0      收藏:0      [点我收藏+]

标签:lnmp

1.安装nginx

     # wget http://nginx.org/packages/rhel/7/x86_64/RPMS/nginx-1.8.1-1.el7.ngx.x86_64.rpm

     # rpm -ivh nginx-1.8.1-1.el7.ngx.x86_64.rpm 


2.安装PHP

     # yum install php-fpm  php-mysql -y

     # systemctl enable php-fpm

     # systemctl start php-fpm


3.在nginx主机上配置php

测试nginx

     # mkdir -pv /www/web1

     # systemctl enable nginx

     # systemctl start nginx

     # iptables -I INPUT -d 192.168.80.11 -p tcp --dport 80 -j ACCEPT

     # iptables-save > /etc/sysconfig/iptables

     # echo "iptables-restore < /etc/sysconfig/iptables" >>/etc/rc.local


配置php

     location ~ \.php$ {

            root               /www/web1/php;

            fastcgi_pass   127.0.0.1:9000;

            fastcgi_index  index.php;

            fastcgi_param  SCRIPT_FILENAME  /www/web1/php/$fastcgi_script_name;

            include           fastcgi_params;

      }

 

测试php

     <?php

     phpinfo();

     ?>


4.搭建一个mysql

     # yum install mariadb-server -y

     # systemctl enable mariadb

     # systemctl start mariadb


授权用户

     grant all on test.* to test@‘192.168.80.%‘ identified by ‘12345‘;

     flush privileges;


测试mysql

     <?php

        $conn=mysql_connect(‘192.168.80.100‘,‘test‘,‘12345‘);

        if ($conn)

            echo "OK.....";

        else

            echo "Failure...";

     ?>


本文出自 “爱吃猫的秋刀鱼” 博客,请务必保留此出处http://yunstudy.blog.51cto.com/13190628/1958428

快速部署一个LNMP

标签:lnmp

原文地址:http://yunstudy.blog.51cto.com/13190628/1958428

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!