centos使用--centos7.3配置LNMP
1 源的配置
1.换成国内的源,可以提高下载速度
首先备份/etc/yum.repos.d/CentOS-Base.repo
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
下载对应版本repo文件, 放入/etc/yum.repos.d/(操作前请做好相应备份)
cd /etc/yum.repos.d/
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
运行以下命令生成缓存
yum clean all
yum makecache
参考地址: http://mirrors.163.com/.help/centos.html
2.添加更多的源
CentOS由于很追求稳定性,所以官方源中自带的软件不多,因而需要一些第三方源:epel是对官方源的补充,可以提供更新更丰富的rpm包;官方不提供php7的rpm包,php7有两个源可以选择,一个是webtatic提供的,也就是php70w,另一个可以使用remi源,我使用的是webtatic提供的
安装相应的源(webtatic依赖epel)
CentOS/RHEL 7.x:
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
2 安装软件
注意:前提是有可用的源,出于安全和稳定等原因,有些软件包是本身的源不具备的
2.1 安装php7
yum install php70w php70w-fpm php70w-mysql
php -v //查看是否安装成功
其它一些可以安装的扩展等
yum install php70w-devel
yum install php70w-pdo php70w-xml php70w-mbstring
2.2 安装nginx
yum install nginx
nginx -v
2.3 安装mysql
yum install mariadb-server -y //安装
systemctl start mariadb.service //启动
systemctl enable mariadb.service //设置开机启动
mysql_secure_installation //初始化设置
2.4 安装vsftp (ftp登录配置)
yum install vsftpd
相关操作
禁止匿名登陆
vim /etc/vsftpd/vsftpd.conf 将配置文件中第11行
anonymous_enable=YES
anonymous_enable=NO
允许root账户登录,编辑/etc/vsftpd/user_list和/etc/vsftpd/ftpusers两个设置文件脚本,将root账户前加上#号变为注释。(即让root账户从禁止登录的用户列表中排除)
开启vsftpd
service vsftpd start
本地客户端filezilla,百度自行下载配置
3 开机启动设置
systemctl enable mariadb.service
systemctl enable php-fpm.service
systemctl enable nginx.service
systemctl enable vsftpd.service
相关操作
查看开机启动情况
systemctl list-unit-files
systemctl list-unit-files | grep fpm
设置为开机启动
systemctl enable mariadb.service
取消开机启动
systemctl disable mariadb.service
4 其它一些配置
4.1 git的设置
下载git
yum install git
生成密钥,位置在~/.ssh文件夹下
ssh-keygen -t rsa -C "your_email@example.com"
全局配置
git config [--global] user.name "name"
git config [--global] user.email "email address"
4.2 mysql本地登录
步骤:
登陆mysql
mysql -uroot -p123456
切换到mysql这个数据库
mysql> use mysql;
查看root用户配置
mysql> select host,user from user where user='root';
如果查询结果中不包含以下记录,请添加,否则请忽略次步骤
+--------------------+------+
| host | user |
+--------------------+------+
| % | root |
+--------------------+------+
添加方法:
mysql> update user set host = '%' where user = 'root' and host = '127.0.0.1';
+--------------------+------+
| host | user |
+--------------------+------+
| % | root |
| ::1 | root |
| localhost | root |
| vm\_33\_19\_centos | root |
+--------------------+------+
使配置生效
mysql> flush privileges;
配置完成,客户端重新登录成功;
4.3 基本nginx配置
server{
#分别写了www和不带www的域名
server_name www.zhengde.site zhengde.site;
listen 80;
#工程根目录
root /var/data/blog/;
charset UTF-8;
#日志文件位置,自己选择
access_log /var/log/nginx/blog/access.log;
error_log /var/log/nginx/blog/error.log;
index index.php index.html index.htm;
#error_page 500 502 503 504 404 /missing.html;
#error_page 403 =404 /missing.html;
#主要作用是xxxx/index.php/控制器/方法,一般的index.php是隐藏的,不写这句就找不到了
location / {
try_files $uri /index.php$is_args$args;
}
location ~ \.php$ {
#这个要看你监听的位置
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
#二选一,第一种写法
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
#二选一,第二种写法,但是需要在外层创建 fastcgi.conf文件
# include fastcgi.conf;
}
}
4.4 certbot安装(用于生成https证书,不用可忽略)
sudo yum install certbot-nginx
certbot certonly --webroot -w /data/blog -d xxxx.cn -w /data/blog -d www.xxxx.cn -w /data/blog -d xxxx.cn -w /data/blog -d www.xxxx.cn
centos使用--centos7.3配置LNMP的更多相关文章
- CentOS 6.5安装配置LNMP服务器(Nginx+PHP+MySQL)
CentOS 6.5安装配置LNMP服务器(Nginx+PHP+MySQL) 一.准备篇: /etc/init.d/iptables stop #关闭防火墙 关闭SELINUX vi /etc/sel ...
- CentOS 6.4安装配置LNMP服务器(Nginx+PHP+MySQL)
准备篇 1.配置防火墙,开启80端口.3306端口 vi /etc/sysconfig/iptables-A INPUT -m state --state NEW -m tcp -p tcp --dp ...
- linux CentOS7.2配置LNMP
转自http://www.centoscn.com/CentosServer/www/2014/0904/3673.html 准备篇: CentOS 7.0系统安装配置图解教程 http://www. ...
- 阿里云里Centos 7 PHP7环境配置 LNMP
首先更新系统软件</str> $ yum update 安装nginx</str></str> 1.安装nginx源 $ yum localinstall http ...
- 阿里云 Centos 7 PHP7环境配置 LNMP
首先更新系统软件 $ yum update 安装nginx 1.安装nginx源 $ yum localinstall http://nginx.org/packages/centos/7/noarc ...
- CentOS 6.4安装配置LNMP服务器(Nginx+PHP+MySQL)
一 安装篇 1. 安装nginx yum check-update #更新yum源 yum remove httpd* php* #删除系统自带的软件包 yum install nginx #安装ng ...
- CentOS7.2配置LNMP环境并安装配置网站WordPress
1,安装环境查看 2,安装MySQL5.7.22 下载MySQL wget https://downloads.mysql.com/archives/get/file/mysql-5.7.22-1.e ...
- CentOS 6.5 yum安装配置lnmp服务器(Nginx+PHP+MySQL)
以下全部转载于 http://blog.csdn.net/lane_l/article/details/20235909 本人于今晚按照该文章使用centos 6.7 64bit安装成功,做个备份, ...
- CentOS安装与配置LNMP
本文PDF文档下载:http://www.coderblog.cn/doc/Install_and_config_LNMP_under_CentOS.pdf 本文EPUB文档下载:http://www ...
随机推荐
- 调试wmi连接主机进行监控
wmi连接及配置 1.首先介绍两款连接wmi的工具: ①windows自带的wbemtest. ②WMI 资源浏览器 两者都是可以连接wmi,并且执行相关命令的工具. 2.尝试连接首先利用win自带的 ...
- 返回json格式 不忽略null字段
返回json格式 不忽略null字段 发布于 353天前 作者 king666 271 次浏览 复制 上一个帖子 下一个帖子 标签: json 如题,一个实体的某个字段如果为null,在 ...
- CNN训练中的技巧
转自: http://weibo.com/p/1001603816330729006673 说明:这个翻译应该是来自原文:http://yyue.blogspot.hk/2015/01/a-brief ...
- runit git-daemon-run 等错误
正在处理用于 man-db (2.7.5-1) 的触发器 ... 正在设置 runit (2.1.2-3ubuntu1) ... start: 无法连接到 Upstart: Failed to con ...
- 利用bootstrap实现图片Carousel效果
引入头文件: <link rel="stylesheet" href="bootstrap.min.css"> <link rel=" ...
- CBCGPImage的GetSize的问题及解决方法
BCGControlBar Pro for MFC 25.10是目前(2018-07-16)网上能够找到的最新能够使用的版本,我配合Visual Studio 2010使用.在单文档MFC程序的视图中 ...
- 全文检索(Lucene&Solr)
全文检索(Lucene&Solr) 1)什么是全文检索?为什么需要全文检索? 结构化数据(mysql等)方便查询,而非结构化数据(如多篇文章)是难以查询到自己需要的,所以要使用全文检索. 全文 ...
- springBoot支持PageHelp插件使用学习笔记
首先在springboot项目的maven中加入依赖(版本可能需要自己选择合适的) <dependency> <groupId>com.github.pagehelper< ...
- 《JSON笔记之二》----封装JSONUtil
许多java开发人员对于fastjson再也熟悉不过了,这是alibaba开源的依赖,使用fastjson可以使我们很容易的把请求json串转换成为我们所需要的对象.list.map等对象格式,对于开 ...
- Go Doc文档
Go为我们提供了快速生成文档和查看文档的工具,很容易编写查看代码文档.在项目协作过程中,可以帮助我们快速理解代码. 查看文档方式有两种:一种是通过终端查看,使用go doc命令,一种是通过网页查看,使 ...