笔记

1、晨考

1、NFS共享文件步骤

- 服务端

[root@backup ~]# yum install nfs-utils rpcbind -y
[root@backup ~]# mkdir /backup
[root@backup ~]# vim /etc/exports
/backup 172.16.1.0/20(rw,sync,all_squash,anonuid=666,anongid=666)
[root@backup ~]# groupadd www -g 666
[root@backup ~]# useradd www -u 666 -g 666 -M -r -s /sbin/nologin
[root@backup ~]# chown -R www.www /backup
[root@backup ~]# systemctl start nfs-server rpcbind - 客户端
[root@backup ~]# yum install nfs-utils -y
[root@backup ~]# mount -t nfs 172.16.1.31:/backup /opt 2、安装WEb服务的步骤
[root@backup ~]# yum install httpd php php-devel -y
[root@backup ~]# cd /var/www/html

2、昨日问题

1、nfsnobody
2、NFS挂载无法持久化
1、通过开机自启动脚本挂载
[root@web01 html]# vim /etc/rc.local
/usr/bin/mount -t nfs 172.16.1.31:/web/upload /var/www/html/upload
[root@web01 html]# chmod +x /etc/rc.d/rc.local 2、通过/etc/fstab配置文件
[root@web02 ~]# vim /etc/fstab
# 挂载点 挂载的目录 类型 设置默认权限 0 不备份 1 备份 0 不检查 1 检查
172.16.1.31:/web/upload /var/www/html/upload nfs defaults 0 0
[root@web02 ~]# mount -a

3、今日内容

1、了解web服务
2、部署Nginx
Nginx和Apache的对比

4、什么是web服务

web就是B/S架构

5、web服务器软件

1、apache
网络模型
select
poll
epoll 2、Nginx 官网:https://nginx.org/
软件:https://nginx.org/download/

6、部署Nginx

1、yum安装
[root@web01 ~]# vim /etc/yum.repos.d/nginx.repo
[root@web01 ~]# yum install nginx -y
[root@web01 ~]# systemctl stop httpd
[root@web01 ~]# systemctl start nginx 2、二进制安装 3、编译安装
[root@web01 ~]# wget https://nginx.org/download/nginx-1.20.2.tar.gz
[root@web01 ~]# tar -xf nginx-1.20.2.tar.gz
[root@web01 nginx-1.20.2]# ./configure
[root@web01 nginx-1.20.2]# make
[root@web01 nginx-1.20.2]# make install

7、平滑增加Nginx模块

增加模块必须重新编译。
[root@web01 ~]# tar -xf nginx-1.20.2.tar.gz
[root@web01 ~]# cd nginx-1.20.2
[root@web01 nginx-1.20.2]#./configure --with-http_ssl_module
[root@web01 nginx-1.20.2]#make
[root@web01 nginx-1.20.2]#make install

8、Nginx的命令

1、-v : 打印版本号
[root@web01 ~]# nginx -v
nginx version: nginx/1.20.2 2、-V : 打印版本号和配置项
[root@web01 ~]# nginx -V
nginx version: nginx/1.20.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx 3、-t : 检查配置文件
[root@web01 ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful 4、-T : 测试配置文件并启动后退出 5、-q :打印错误日志 6、-s : 操作进程
stop :停止
quit :退出
reopen :重启
reload :重载
7、-p : 指定nginx的工作目录
8、-e : 指定错误日志路径
9、-c : 指定配置文件的路径
10、-g : 设置一个全局的Nginx配置项
[root@web01 ~]# nginx -g 'daemon off;'

9、Nginx配置文件

全局配置和模块配置

1、全局配置
1、user : 指定Nginx的启动用户
2、worker_processes : 定义Nginx的worker进程数
auto === CPU数量
3、error_log : 错误日志路径
4、pid : pid的存放文件路径
5、events : 模块配置
5.1、worker_connections :每一个worker进程最多同时接入多少个请求
5.2、use : 指定Nginx的网络模型
6、http : web服务的模块
6.1、include : 加载外部的配置项
6.2、default_type : 如果找不到文件的类型,则按照指定默认类型处理
6.3、log_format : 定义日志格式
log_format json '{"@timestamp":"$time_iso8601",'
'"host":"$server_addr",'
'"service":"nginxTest",'
'"trace":"$upstream_http_ctx_transaction_id",'
'"log":"log",'
'"clientip":"$remote_addr",'
'"remote_user":"$remote_user",'
'"request":"$request",'
'"http_user_agent":"$http_user_agent",'
'"size":$body_bytes_sent,'
'"responsetime":$request_time,'
'"upstreamtime":"$upstream_response_time",'
'"upstreamhost":"$upstream_addr",'
'"http_host":"$host",'
'"url":"$uri",'
'"domain":"$host",'
'"xff":"$http_x_forwarded_for",'
'"referer":"$http_referer",'
'"status":"$status"}';
指定日志模式
access_log /var/log/nginx/access.log json ;
6.4、sendfile : 高效读取文件
6.5、keepalive_timeout : 长连接保持连接的
HTTP 1.0 短链接
HTTP 1.1 长连接
6.6、server : 网址模块
6.6.1、listen : 监听的端口
6.6.2、server_name : 定义域名
6.6.3、location : 访问路径
6.6.3.1、root : 指定网址路径
6.6.3.2、index : 指定网址的索引文件

10、超级玛丽和象棋

1、上传代码

2、编辑配置文件
[root@web01 conf.d]# vim /etc/nginx/conf.d/game.conf
server {
listen 80;
server_name game.test.com;
location / {
root /opt/Super_Marie;
index index.html;
}
} 3、测试配置文件是否正常
[root@web01 conf.d]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful 4、重启Nginx
[root@web01 conf.d]# systemctl restart nginx 5、域名解析
C:\Windows\System32\drivers\etc\hosts
172.16.1.7 game.test.com

5、架构--Nginx、搭建超级玛丽游戏的更多相关文章

  1. 第九章 nginx基础之搭建小游戏

    一.nginx部署 1.epel源安装 [root@web01 ~]# yum install -y nginx 2.官方源安装 1.配置官方源[root@web02 ~]# vim /etc/yum ...

  2. Nginx搭建游戏

    目录 一:Nginx搭建<小游戏> 1.上传<象棋游戏>代码 2.编辑配置文件(尾部必须要加 .conf<文件>) 3.测试配置文件是否正常 4.重启Nginx 5 ...

  3. Linux:LNMP架构的搭建

    LNMP架构的搭建 centos6.8-i686 MySQL PHP Nginx 搭建前先安装一些必要的rpm和php组件(全新系统) yum install -y wget gcc vim* lib ...

  4. LNMP架构的搭建

    第9章 LNMP架构的搭建 9.1 什么是LNMP 9.1.1 LNMP的组成 L                linux N                nginx:实现静态的服务处理 M    ...

  5. 【Nginx】如何使用Nginx搭建流媒体服务器实现直播?看完这篇我会了!!

    写在前面 最近几年,直播行业比较火,无论是传统行业的直播,还是购物.游戏.教育,都在涉及直播.作为在互联网行业奋斗了多年的小伙伴,你有没有想过如果使用Nginx搭建一套直播环境,那我们该如何搭建呢?别 ...

  6. Haproxy配合Nginx搭建Web集群部署

    Haproxy配合Nginx搭建Web集群部署实验 1.Haproxy介绍 2.Haproxy搭建 Web 群集 1.Haproxy介绍: a)常见的Web集群调度器: 目前常见的Web集群调度器分为 ...

  7. nginx搭建http和rtmp协议的流媒体服务器

    nginx搭建http和rtmp协议的流媒体服务器 时间:2013-09-23 23:52来源:佚名 作者:本站 举报 点击:232次 实验目的:让Nginx支持flv和mp4格式文件,同时支持Rtm ...

  8. Nginx搭建flv视频点播服务器

    Nginx搭建flv视频点播服务器 前一段时间使用Nginx搭建的多媒体服务器只能在缓冲过的时间区域内拖放, 而不能拖放到未缓冲的地方. 这就带来了一个问题: 如果视频限速的速率很小, 那么客户端观看 ...

  9. Nginx搭建反向代理服务器

    [大型网站技术实践]初级篇:借助Nginx搭建反向代理服务器   一.反向代理:Web服务器的“经纪人” 1.1 反向代理初印象 反向代理(Reverse Proxy)方式是指以代理服务器来接受int ...

随机推荐

  1. win10 安装vue 详解-包括node.js、npm、webpack

    1.下载 去官网下载 node.js https://nodejs.org/en/download/ 一般不会选择最新的,我安装的是 12.18.4 进入历史记录页面网址 https://nodejs ...

  2. HBase环境搭建(hbase1.2.5+zookeeper3.4.6)

    注:图片如果损坏,点击文章链接:https://www.toutiao.com/i6627857018461880836/ 系统版本,Hadoop已安装完成 Mysql安装完成 Hive版本 Sqoo ...

  3. Linux内核模块学习

    注:本文是<Linux设备驱动开发详解:基于最新的Linux 4.0内核 by 宋宝华 >一书学习的笔记,大部分内容为书籍中的内容. 书籍可直接在微信读书中查看:Linux设备驱动开发详解 ...

  4. hisql orm 框架insert数据写入教程

    hisql.net 官网(文档编写中) HiSql 源码(github) https://github.com/tansar/HiSql git clone https://github.com/ta ...

  5. 阿里云服务器ECS Ubuntu16.04 + Seafile 搭建私人网盘 (Seafile Pro)

    原文链接:? 传送门 本文主要讲述 使用 Ubuntu 16.04 云服务器 通过脚本实现对 Seafile Pro 的安装,完成私人网盘的搭建 首先给出 Seafile 专业版的下载地址(Linux ...

  6. SparkSQL学习笔记

    概述 冠状病毒来临,宅在家中给国家做贡献之际,写一篇随笔记录SparkSQL的学习笔记,目的有二,一是记录整理之前的知识作为备忘录,二是分享技术,大家共同进步,有问题也希望大家不吝赐教.总体而言,大数 ...

  7. 使用Rainbond打包业务模块,实现业务积木式拼装

    背景 每个程序员在学习开发的过程中,都知道解耦和模块化的重要性,也希望自己设计和开发的程序支持模块化,开发好的模块其他人就能快速复用,为了达成这个效果,我们学习各种模块化和解耦的技术,从面向对象的设计 ...

  8. git 重置密码后,本地电脑需要修改git密码

    查看用户名git config user.name 查看密码git config user.password 查看邮箱git config user.email 修改密码git config --gl ...

  9. 【刷题-LeetCode】199 Binary Tree Right Side View

    Binary Tree Right Side View Given a binary tree, imagine yourself standing on the right side of it, ...

  10. 微服务架构 | 2.2 Alibaba Nacos 的统一配置管理

    目录 前言 1. Nacos 配置中心基础知识 1.1 Nacos 在配置中心中的功能 1.2 Nacos 配置管理 Data ID 的构成 1.3 Nacos 配置的回滚机制 1.4 Nacos 配 ...