linux中Centos7搭建lnmp环境
1、安装yum
yum update
2、安装nginx源:
yum localinstall http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum repolist enabled | grep "nginx*"
安装nginx
yum -y install nginx
启动nginx
systemctl start nginx
设置开机自启动
systemctl enable nginx.service
3、检查开机自启动是否设置成功
systemctl list-dependencies | grep nginx
4、浏览器中输入公网ip,检测是否安装成功
出现如下则成功

5、安装mysql
安装mysql源
yum -y localinstall http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
yum repolist enabled | grep "mysql.*-community.*"
安装mysql
yum -y install mysql-community-server install mysql-community-devel
启动mysql
systemctl mysqld start
检查mysql启动是否正常
sytemctl mysqld status 或者 ps -ef | grep mysql
设置mysqld服务开机自启动
systemctl enable mysqld.service
检查mysqld开机自启动是否设置成功
systemctl list-dependencies | grep mysqld
mysql5.7以后的争强了安全机制, 所以使用yum安装,启动会系统会自动生成一个随机的密码,修改mysql密码
查看mysql的随机密码
grep 'temporary password' /var/log/mysqld.log
使用查询得到的随机密码在终端登录
mysql -u root -p 更改密码(mysql文档规定,密码必须包括大小写字母数字加特殊符号>8位) 根据获取的随机密码登录
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Yourpassword';修改密码
退出mysql客户端,用刚才修改的密码登录确保密码修改成功 exit;
使用新密码登录
6、安装php
安装php源
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
安装php扩展源(这是php7.1的安装其他版本直接把7.1直接改成7.2)
yum repolist enabled | grep "webtatic*"
yum -y install php71w php71w-fpm
yum -y install php71w-mbstring php71w-common php71w-gd php71w-mcrypt
yum -y install php71w-mysql php71w-xml php71w-cli php71w-devel
yum -y install php71w-pecl-memcached php71w-pecl-redis php71w-opcache
验证php7.1.x和扩展是否安装成功
php -m
验证php是否安装成功
php -v 会出现php的班本信息
7、配置nginx文件
新建.conf后缀的文件文件目录在/etc/nginx/conf.d/下面 复制下面内容放进去
server {
listen 80;
server_name danshufenxiang.com;
root /home/www; #自定义站点位置这是你的站点根目录
index index.php index.html index.htm;
location / {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
linux中Centos7搭建lnmp环境的更多相关文章
- CentOS7——搭建LNMP环境(WordPress案例)
CentOS7--搭建LNMP环境(WordPress案例) LNMP组成介绍 LNMP(Linux-Nginx-MySQL-PHP)网站架构是目前国际流行的Web框架,该框架包括:Linux操作系统 ...
- [Linux] deepin15.8搭建LNMP环境
LAMP和LNMP LAMP==Linux+Apache+Mysql+PHP LNMP==Linux+Nginx+Mysql+PHP 安装nginx sudo apt install nginx 安装 ...
- Centos7 搭建lnmp环境 (centos7+nginx+MySQL5.7.9+PHP7)
阿里云一台服务器出现问题! 我估计是一键安装包环境的原因,所以打算重新搭建下环境! 首先,当然是先做好快照!安全第一! 对系统盘做更换系统操作,装上纯净版的centos. 装好后,进入系统 一.挂载数 ...
- CentOS7搭建LNMP环境
以前写的过时了,重新发一篇新的. 安装PHP 下载官网:https://www.php.net/downloads.php 为了方便,我存了现成的 百度网盘:https://pan.baidu.com ...
- Vmware搭建LNMP环境(Centos7+Nginx+Mysql+PHP7.1.8)
参考:1.Linux学习之CentOS(一)----在VMware虚拟机中安装CentOS 7(图文教程) 2.Centos7搭建LNMP环境 3.MySQL5.7修改默认root密码 4.CentO ...
- centos7 yum搭建lnmp环境及配置wordpress超详细教程
yum安装lnmp环境是最方便,最快捷的一种方法.源码编译安装需要花费大量的人类时间,当然源码编译可以个性化配置一些其它功能.目前来说,yum安装基本满足我们搭建web服务器的需求. 本文是我根据近期 ...
- WIN10 vagrant和virtualbox虚拟机和一键搭建lnmp环境配置thinkphp虚拟主机
版本:win10系统 virtualbox:5.1.26 vagrant :1.9.7 centos 7.0 xshell/git 首先下载好对应版本的软件 配置vagrant和virtualbox ...
- Yum搭建LNMP环境(动、静、库分离)(week4_day5)--技术流ken
前言 本篇博客使用yum来搭建lnmp环境,将采用动态,静态以及数据库分开安装的方式即nginx,php,mysql.会被分开安装在不同的服务器之上,搭建出来一套lnmp环境,并部署wordpress ...
- docker搭建lnmp环境(问题,资料,命令)
入门参考 http://www.runoob.com/docker/docker-install-nginx.html 十大常用命令玩转docker 1. #从官网拉取镜像 docker pull & ...
随机推荐
- lua C++ wrapper
背景 最近在研究lua的c++绑定库,使用过一下几个 luabind 问题:没人维护 https://github.com/vinniefalco/LuaBridge https://github.c ...
- zeromy quick start - python
软件: pip install pyzmq 代码: ==server.py # # Hello World server in Python # Binds REP socket to t ...
- 使用Jenkins 安装和自动化部署项目
安装 jenkins 安装方法可以使用war 安装 或者服务安装.我这里使用 rpm 安装 第一步: 我们使用的 centos ,选着这个,直接 下载传到服务器上.或者 复制下载链接 到 服务器上 ...
- ubuntu网络配置及端口名修改
一.网络配置文件 buntu系统进行网络配置有的时候用图形界面不起作用,这种情况下可以直接修改某些启动脚本或配置文件 Ubuntu系统进行网络配置涉及到几个配置文件1./etc/network/int ...
- java中四种访问修饰符
Java中的四种访问修饰符:public.protected.default(无修饰符,默认).private. 四种修饰符可修饰的成分(类.方法.成员变量) public protected d ...
- Java读写HDFS文件
一.依赖包maven路径 <!-- https://mvnrepository.com/artifact/org.apache.hadoop/hadoop-client --> <d ...
- Simple Logging Facade for Java 简单日志门面(Facade)
SLF4J是为各种 loging APIs提供一个简单统一的接口,从而使得最终用户能够在部署的时候配置自己希望的loging APIs实现.Logging API实现既可以选择直接实现SLF4J接口的 ...
- 安装phantomjs(Ubuntu版本 MacOS版本)
安装phantomjs(Ubuntu版本) 首先:apt-get update # 更新软件列表. apt-get upgrade # 更新软件. 其次再执行如下步骤 步骤一下载包:wget http ...
- 跟着未名学Office - 高效笔记OneNote
了解OneNote 2016年12月22日 19:57 OneNote Summary 理解OneNote中的笔记本.分区.页的概念 编写人:未名 感谢秦大: http://www.zloffi ...
- 黄聪:Pjax 无刷新开发web,更好用户体验
什么Ajax.Pjax.Njax...神马玩意? 有Njax吗? 木有...不过真有Pjax!! 其实pjax就是用到了html5的新history api: pushState和replaceSta ...