当前位置: 首页 > news >正文

做下载网站赚钱吗网课免费平台

做下载网站赚钱吗,网课免费平台,优购物官方网站手机,张家港做外贸网站LNMP分布式剧本 一:环境设置二:编写Nginx剧本准备nginx下载源准备配置文件并开放PHP的访问路径准备php测试页面编写nginx剧本 三:编写Mysql剧本编写密码获取脚本准备Mysql的yum源编写mysql剧本 四:准备PHP剧本准备两个配置文件编写…

LNMP分布式剧本

  • 一:环境设置
  • 二:编写Nginx剧本
    • 准备nginx下载源
    • 准备配置文件并开放PHP的访问路径
    • 准备php测试页面
    • 编写nginx剧本
  • 三:编写Mysql剧本
    • 编写密码获取脚本
    • 准备Mysql的yum源
    • 编写mysql剧本
  • 四:准备PHP剧本
    • 准备两个配置文件
    • 编写php剧本

一:环境设置

主机部署应用
192.168.52.100ansible
192.168.52.110nginx
192.168.52.120mysql
192.168.52.130php

二:编写Nginx剧本

准备nginx下载源

mkdir -p /etc/ansible/playbook/nginx
cd /etc/ansible/playbook/nginx
vim nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1

准备配置文件并开放PHP的访问路径

vim default.conf 
...
location / {root   /usr/share/nginx/html;index  index.html index.htm index.php;# 添加Nginx.php匹配项}
....
location ~ \.php$ {root           html;fastcgi_pass   192.168.52.130:9000;  #执行php的服务器和端口fastcgi_index  index.php;fastcgi_param  SCRIPT_FILENAME  /usr/share/nginx/html$fastcgi_script_name;include        fastcgi_params;

准备php测试页面

vim /etc/ansible/playbook/nginx/index.php
<?php
phpinfo();
?>

编写nginx剧本

vim /etc/ansible/playbook/nginx/nginx.yml 
- name: LAMP nginxhosts: webserversremote_user: roottasks:- name: stop firewalld #关闭防火墙service: name=firewalld state=stopped enabled=no- name: stop selinux #关闭selinuxcommand: '/usr/sbin/setenforce 0'ignore_errors: true- name: nginx.repo #准备Nginx的yum源copy: src=/etc/ansible/playbook/nginx/nginx.repo dest=/etc/yum.repos.d/nginx.repo- name: install nginx #下载nginxyum: name=nginx- name: start nginx #启动Nginxservice: name=nginx state=started enabled=yes- name: copy nginx.conf #修改配置文件copy: src=/etc/nginx/conf.d/default.conf dest=/etc/nginx/conf.d/default.confnotify: "restart nginx" #指定触发器- name: index.php #准备网页测试王建copy: src=/etc/ansible/playbook/nginx/index.php dest=/usr/share/nginx/htmlhandlers:- name: restart nginx #触发器任务,重启Nginxservice: name=nginx state=restarted
ansible-playbook nginx.yml  

三:编写Mysql剧本

编写密码获取脚本

mkdir -p /etc/ansible/playbook/mysql
vim /etc/ansible/playbook/mysql/passwd.sh#!/bin/bash
#获取Mysql的密码
passd=$(grep "password" /var/log/mysqld.log | awk '{print $NF}' | head -1)
#更改密码
mysql -uroot -p"$passd" --connect-expired-password -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'Admin@123';"
#授权
mysql -uroot -pAdmin@123 -e "grant all privileges on *.* to root@'%' identified by 'Admin@123' with grant option;

准备Mysql的yum源

sed -i 's/gpgcheck=1/gpgcheck=0/' /etc/yum.repos.d/mysql-community.repo

编写mysql剧本

vim /etc/ansible/playbook/mysql/mysql.yml
- name: LAMP mysqlhosts: mysqlremote_user: roottasks:- name: stop firewalldservice: name=firewalld state=stopped enabled=no- name: stop selinuxcommand: '/usr/sbin/setenforce 0'ignore_errors: true- name: install mysql.repo #转变mysql瞎子啊源shell: wget https://repo.mysql.com/mysql57-community-release-el7-11.noarch.rpm && rpm -ivh mysql57-community-release-el7-11.noarch.rpmignore_errors: true- name: mysql.repo #修改yum源,把仓库打开copy: src=/etc/yum.repos.d/mysql-community.repo dest=/etc/yum.repos.d/mysql-community.repo- name: install mysql #下载mysqlyum: name=mysql-server- name: start msql #启动mysqlservice: name=mysqld state=started enabled=yes- name: grep passwd #指定修改密码脚本,修改密码并授权script: /etc/ansible/playbook/mysql/passwd.sh
ansible-playbook mysql.yml  

四:准备PHP剧本

准备两个配置文件

php.ini

#添加修改时时区
date.timezone = Asia/Shanghai

www.conf文件

user = php
group = php
listen = 192.168.52.130:9000
listen.allowed_clients = 192.168.52.110

编写php剧本

vim //etc/ansible/playbook/php.yml
- name: LAMP nginxhosts: dbserversremote_user: roottasks:- name: stop firewalldservice: name=firewalld state=stopped enabled=no- name: stop selinuxcommand: '/usr/sbin/setenforce 0'ignore_errors: true- name: install php1 #准备php下载源shell: rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm && rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpmignore_errors: true- name: install php2 #下载PHP及依赖包shell: yum -y install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-gd php72w-mbstring php72w-pdo php72w-xml php72w-fpm php72w-mysqlnd php72w-opcacheignore_errors: true- name: start php #开启phpservice: name=php-fpm state=started enabled=yes- name: user php #创建运行用户user: name=php create_home=no shell=/sbin/nologin- name: php.ini #修改配置文件copy: src=/etc/ansible/playbook/php.ini dest=/etc/php.ini- name: www.confcopy: src=/etc/ansible/playbook/www.conf dest=/etc/php-fpm.d/www.conf- name: create nginxfile: name=/usr/share/nginx state=directory- name: create nginxfile: name=/usr/share/nginx/html state=directory- name: index.php #准备测试页面copy: src=/etc/ansible/playbook/nginx/index.php dest=/usr/share/nginx/html
ansible-playbook php.yml  
http://www.dt0577.cn/news/21949.html

相关文章:

  • 怎么做微商网站百度云搜索资源入口
  • 如何建立一个网站网络营销战略有什么用
  • 今天开始做魔王免费观看网站杭州seo培训
  • 南通高端网站建设公司seo优化轻松seo优化排名
  • 自己做效果图的网站互联网舆情
  • 微信个人公众号怎么创建成都最好的网站推广优化公司
  • 网站开发的技术难点怎么关闭seo综合查询
  • 设置网站建设拓客团队怎么联系
  • 我的校园网站制作广告推广系统
  • 网站建设费用组成线下营销推广方式有哪些
  • 网站是自己做还是让别人仿aso优化是什么
  • 做网站公司好互联网销售
  • 域名备案完了怎么做网站发稿
  • 巢湖网站开发文章优化关键词排名
  • 独立商城系统网站建设等服务2023疫情最新情况
  • 网站建设水平如何评价舆情网站直接打开
  • 网站调优技能福州排名seo公司
  • 做3dmax的网站怎么做网络销售
  • wordpress新增站点东莞网站推广技巧
  • wordpress热门文章查询班级优化大师官方免费下载
  • 网站用什么语言做网站免费制作平台
  • 一个网站能多个域名做不同站点seo是什么姓氏
  • 做富集的网站如何创建一个网页
  • 什么可以做冷门网站百度一下百度下载
  • 沈阳餐饮网站建设seo的课谁讲的好
  • 网站内容不能够复制怎么做推广自己产品的文案
  • 石龙网站开发国际新闻最新消息今天 新闻
  • 班级网站开发与设计互联网营销师考试题库
  • 企业网站推广哪些效果比较好百度浏览器入口
  • 西安做网站 怎样备案线上推广引流渠道