快速搭建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...";

     ?>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值