要求:centos 7+ 搭建LNMP

6 篇文章 0 订阅
2 篇文章 0 订阅

服务器要求:centos 7+

数据库链接不上可能原因

a、关闭防火墙:service firewalld stop
b、阿里云的安全部3306端口是否开放

1、安装nginx

2、数据库

  • 安装数据库

    yum -y install mariadb mariadb-server
    systemctl start mariadb

  • 设置开机启动

    systemctl enable mariadb

  • 接下来进行MariaDB的相关简单配置

    mysql_secure_installation

  • 首先是设置密码,会提示先输入密码

    Enter current password for root (enter for none):<–初次运行直接回车

  • 设置密码

    Set root password? [Y/n] <– 是否设置root用户密码,输入y并回车或直接回车
    New password: <– 设置root用户的密码
    Re-enter new password: <– 再输入一次你设置的密码

  • 其他配置

    Remove anonymous users? [Y/n] <– 是否删除匿名用户,回车

    Disallow root login remotely? [Y/n] <–是否禁止root远程登录,回车,

    Remove test database and access to it? [Y/n] <– 是否删除test数据库,回车

    Reload privilege tables now? [Y/n] <– 是否重新加载权限表,回车

    初始化MariaDB完成,接下来测试登录

    mysql -uroot -ppassword

    完成。

  • 赋予远程访问的权

    grant all privileges on *.* to root@’%’ identified by “mfh0828” with grant option;

3、安装php

  • 卸载php

    rpm -qa | grep php 查看安装包
    然后删除 rpm -e xxxx

  • 安装php

    a、 yum install epel-release
    b、 rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

  • 扩展

    yum install –enablerepo=remi –enablerepo=remi-php56 install php-fpm php-common php-mysql php-opcache php-pear php-gd php-devel php-mbstring php-mcrypt php-cli php-pdo php-xml php-pecl-xdebug -y

相关网址
LNMP一键搭建脚本

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值