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

部署nginx多站点游戏

一、Nginx 多游戏站点部署前置环境准备

1.安装vim命令

yum -y install vim

2.CentOS系统需要关闭selinux

#关闭selinux [root@oldboy ~]# setenforce 0 [root@oldboy ~]# getenforce Permissive # 变为此单词成功 #永久关闭、禁止开机自启 [root@oldboy ~]# sed -i '7c SELINUX=disabled' /etc/selinux/config

3.关闭firewalld防火墙

#立即停止当前正在运行的firewalld防火墙(临时关闭,重启服务器后防火墙会自动恢复开启) [root@oldboy ~]# systemctl stop firewalld #取消开机自启firewalld防火墙 [root@oldboy ~]# systemctl disable firewalld 或 #立刻关闭防火墙 + 永久取消开机自启,一条命令完成上面两条的效果 [root@oldboy ~]# systemctl disable --now firewalld

4.配置epel仓库

[root@oldboy ~]# wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo

5.安装wget命令

[root@oldboy ~]# yum -y install wget

6.安装nginx服务(做网站的服务)

[root@oldboy ~]# yum -y install nginx

7.第三步: 启动nginx服务

# 立即启动nginx服务 [root@oldboy ~]# systemctl start nginx # 设置开机自启 [root@oldboy ~]# systemctl enable nginx\ 或 #一条命令同时「启动 + 开机自启」 [root@oldboy ~]#systemctl enable --now nginx

二、搭建植物大战僵尸

1.进入到nginx/conf.d配置文件目录

#进入到nginx/conf.d配置文件目录 [root@oldboy ~]# cd /etc/nginx/conf.d [root@oldboy /etc/nginx/conf.d]# ll total 0

2.创建植物大战僵尸专属 Nginx 配置文件 zwdzjs.conf

[root@oldboy /etc/nginx/conf.d]# vim zwdzjs.conf #将一下配置文件写进去 server { listen 80; #监听端口,当前网站使用80端口(http默认端口) server_name www.zwdzjs.com; #绑定访问域名,访问 www.zwdzjs.com 才会匹配这个站点 location / { # location / 匹配所有访问路径,/ 代表根路径,所有请求都会进入这里 root /code/zwdzjs; # root:网站代码根目录,浏览器访问时去服务器 /code/zwdzjs 文件夹找文件 index index.html; # index:默认首页文件,访问域名不写文件名时,自动打开 index.html } }

3.检查配置

[root@oldboy /etc/nginx/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@oldboy /etc/nginx/conf.d]# systemctl restart nginx

5.创建一个/code/zwdjs目录来存放植物大战僵尸的压缩包

#创建一个/code/zwdzjs目录来存放植物大战僵尸的压缩包 [root@oldboy ~]# mkdir -p /code/zwdzjs #切换到/code/zwdzjs目录下 [root@oldboy ~]# cd /code/zwdzjs #检查一下当时所在路径 [root@oldboy /code/zwdzjs]pwd /code/zwdzjs

6.上传并解压代码

#1.将植物大战僵尸的压缩包拖拽到/code/zwdzjs目录下 #2.解压植物.zip [root@oldboy /code/zwdzjs]unzip 植物.zip #3.解压后检查当前目录文件 [root@oldboy /code/zwdzjs]# ll 总用量 196012 drwxr-xr-x 2 root root 72 8月 26 2022 预览图 drwxr-xr-x 2 root root 4096 8月 26 2022 audio -rw-r--r-- 1 root root 8603 8月 26 2022 favicon.ico drwxr-xr-x 6 root root 64 8月 26 2022 images -rw-r--r-- 1 root root 165 8月 26 2022 'index (2).html' -rw-r--r-- 1 root root 23989 8月 26 2022 index.html drwxr-xr-x 2 root root 227 8月 26 2022 js drwxr-xr-x 2 root root 8192 8月 26 2022 level -rw-r--r-- 1 root root 200616163 7月 1 15:02 NewPvzJs-v1.6-master.zip -rw-r--r-- 1 root root 773 8月 26 2022 README.md -rw-r--r-- 1 root root 4598 8月 26 2022 U.htm -rw-r--r-- 1 root root 28536 8月 26 2022 UI.css

7..windows做本地hosts劫持,将访问www.zwdzjs.com的用户劫持到10.0.0.107(分为6步)

1. hosts文件存放在windown中的C:\Windows\System32\drivers\etc目录下

2.将hosts文件拖拽到桌面上
3.桌面创建txt文件


4.打开txt文件
5.将hosts拖拽到txt文件中进行修改(在文件最后一行添加)

6.修改完成后按"ctrl+s“保存即可,然后拖回到 C:\Windows\System32\drivers\etc目录下

8. 浏览器访问www.zwdzjs.com

9.如果打不开的话就重新执行第3、4步骤重启一下nginx

三、搭建小霸王(和搭建植物大战僵尸意思,只不过配置文件存放路径不同)

1.进入到nginx/conf.d配置文件目录

#进入到nginx/conf.d配置文件目录 [root@oldboy ~]# cd /etc/nginx/conf.d [root@oldboy /etc/nginx/conf.d]# ll total 0

2.创建植物大战僵尸专属 Nginx 配置文件 xbw.conf

[root@oldboy /etc/nginx/conf.d]# vim xbw.conf #将一下配置文件写进去 server { listen 80; #监听端口,当前网站使用80端口(http默认端口) server_name www.xbw.com; #绑定访问域名,访问 www.xbw.com 才会匹配这个站点 location / { # location / 匹配所有访问路径,/ 代表根路径,所有请求都会进入这里 root /code/xbw; # root:网站代码根目录,浏览器访问时去服务器 /code/xbw 文件夹找文件 index index.html; # index:默认首页文件,访问域名不写文件名时,自动打开 index.html } }

3.检查配置

[root@oldboy /etc/nginx/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@oldboy /etc/nginx/conf.d]# systemctl restart nginx

5.创建一个/code/xbw目录来存放植物大战僵尸的压缩包

#创建一个/code/zwdjs目录来存放植物大战僵尸的压缩包 [root@oldboy ~]# mkdir -p /code/xbw #切换到/code/xbw目录下 [root@oldboy ~]# cd /code/xbw #检查一下当时所在路径 [root@oldboy /code/xbw]pwd /code/xbw

6.上传并解压代码

#1.将植物大战僵尸的压缩包拖拽到/code/xbw目录下 #2.解压FC小霸王怀旧游戏机-HTML源码.zip [root@oldboy /code/xbw]unzip FC小霸王怀旧游戏机-HTML源码.zip #3.解压后检查当前目录文件 [root@oldboy /code/xbw]# ll 总用量 7768 -rw-r--r-- 1 root root 28032 5月 24 2021 bgm.mp3 drwxr-xr-x 2 root root 23 5月 24 2021 css -rw-r--r-- 1 root root 7902976 6月 29 10:53 FC小霸王怀旧游戏机-HTML源码.zip drwxr-xr-x 2 root root 23 5月 24 2021 images -rw-r--r-- 1 root root 8956 5月 24 2021 index.html drwxr-xr-x 2 root root 213 5月 24 2021 js drwxr-xr-x 2 root root 4096 5月 24 2021 roms -rw-r--r-- 1 root root 811 5月 24 2021 shuoming.html

7..windows做本地hosts劫持,将访问www.xbw.com的用户劫持到10.0.0.107(分为6步)

1. hosts文件存放在windown中的C:\Windows\System32\drivers\etc目录下

2.将hosts文件拖拽到桌面上
3.桌面创建txt文件


4.打开txt文件
5.将hosts拖拽到txt文件中进行修改(在文件最后一行添加)

6.修改完成后按"ctrl+s“保存即可,然后拖回到 C:\Windows\System32\drivers\etc目录下

8. 浏览器访问www.xbw.com

三、最后一步: 战斗吧少年

http://www.jsqmd.com/news/1113195/

相关文章:

  • 开源扫地机器人 OOMWOO 项目启动:可自造、本地运行,邀你参与构建!
  • 为什么新手也能搞定朱雀检测?
  • gRPC微服务安全加固实战:从TLS配置到纵深防御的六层防护
  • 告别高额研发、数据孤岛,中钧科技全流程助力实体经济数字化升级!
  • 数字人营销视频工具推荐:适合品牌获客与内容转化的选择思路(2026)
  • 第一章Netty,Worker代码优化后分析
  • 欧朋浏览器推新防护功能,可防“点击修复”攻击!
  • 存储超级周期众生相:原厂拧巴画饼、中游分化挣扎、终端苦不堪言
  • 汽修店引流:亲测2026年6月稳定渠道
  • 江苏代步车托运选增岭物流流程清晰规范
  • 方向科技--银格式 GEO 决策优化系统深度评测:国产大模型下的品牌可见性实战
  • 20 款免费大模型全场景实操指南:从工具选型到多元变现完整闭环
  • 2026 年 SaaS 小程序平台哪个最便宜?3 家平台横向测评
  • 合规链游开发指南:依托区块链技术打造自主可控的沉浸式虚拟世界
  • 高中AI学习系统:学情诊断与错题归因实战指南
  • 钉钉宜搭怎么做?2026权威指南
  • GPS是测试什么东西?
  • 电工证刷题小程序有人用吗?
  • 林曦:康健的身体,仰仗于我们积极地生活
  • 网络流量抓包神器!ngrep 命令超详细教程|数据包级网络 grep
  • JMeter线程组配置全解析:从原理到实战的性能测试指南
  • Adobe-GenP终极指南:3分钟快速激活Adobe全家桶完整方案 [特殊字符]
  • 吾爱大佬开发!全能格式转换工具,可以转换各种音视频文档!
  • go语言项目--实例化(图书管理)--001
  • 中间继电器到底干什么用的?90%的新手没搞懂
  • Java毕业设计实战:Spring Boot+MyBatis-Plus健身房管理系统开发指南
  • 2026 AI编程工具选边站:IDE派与Agent派的温馨拆解
  • 深度解析许可优化策略:让软件授权不再浪费
  • 橡胶垫、密封圈尺寸检测提速方案:一台自动影像测量仪搞定全品类
  • 钱对不上、利润算不准?电商企业多平台对账的深层解法