From e66578b2411bf2ec4521b62986f9cee611d5c60e Mon Sep 17 00:00:00 2001 From: Chunmei Xu Date: Wed, 26 Oct 2022 22:06:31 +0800 Subject: [PATCH] add nginx deploy course Signed-off-by: Chunmei Xu --- anolis-courses/nginx/deploy/finish.md | 1 + anolis-courses/nginx/deploy/index.yaml | 22 ++++++++++++++++++++++ anolis-courses/nginx/deploy/start.md | 1 + anolis-courses/nginx/deploy/step2.md | 10 ++++++++++ anolis-courses/nginx/deploy/step3.md | 6 ++++++ anolis-courses/nginx/deploy/step4.md | 24 ++++++++++++++++++++++++ anolis-courses/nginx/deploy/step5.md | 3 +++ anolis-courses/nginx/deploy/step6.md | 6 ++++++ anolis-courses/nginx/deploy/step7.md | 12 ++++++++++++ anolis-courses/nginx/index.yaml | 10 ++++++++++ 10 files changed, 95 insertions(+) create mode 100755 anolis-courses/nginx/deploy/finish.md create mode 100755 anolis-courses/nginx/deploy/index.yaml create mode 100755 anolis-courses/nginx/deploy/start.md create mode 100755 anolis-courses/nginx/deploy/step2.md create mode 100755 anolis-courses/nginx/deploy/step3.md create mode 100755 anolis-courses/nginx/deploy/step4.md create mode 100755 anolis-courses/nginx/deploy/step5.md create mode 100755 anolis-courses/nginx/deploy/step6.md create mode 100755 anolis-courses/nginx/deploy/step7.md create mode 100755 anolis-courses/nginx/index.yaml diff --git a/anolis-courses/nginx/deploy/finish.md b/anolis-courses/nginx/deploy/finish.md new file mode 100755 index 0000000..7f1353d --- /dev/null +++ b/anolis-courses/nginx/deploy/finish.md @@ -0,0 +1 @@ +恭喜你已经完成nginx部署,自定义HelloWorld页面创建以及环境还原体验! \ No newline at end of file diff --git a/anolis-courses/nginx/deploy/index.yaml b/anolis-courses/nginx/deploy/index.yaml new file mode 100755 index 0000000..59b03b3 --- /dev/null +++ b/anolis-courses/nginx/deploy/index.yaml @@ -0,0 +1,22 @@ +name: deploy +desc: 部署nginx,并自定义HelloWorld +image: Anolis OS 8.4 ANCK 64位 +live_time: 30min +machine: x86_64-2c4g +max_clients: 1 +details: + steps: + start: start.md + - name: 安装部署nginx + content: step2.md + - name: 访问nginx欢迎页面 + content: step3.md + - name: 添加自定义HelloWorld页面 + content: step4.md + - name: 重启nginx服务 + content: step5.md + - name: 访问HelloWorld页面 + content: step6.md + - name: 环境还原 + content: step7.md + finish: finish.md diff --git a/anolis-courses/nginx/deploy/start.md b/anolis-courses/nginx/deploy/start.md new file mode 100755 index 0000000..2133b3d --- /dev/null +++ b/anolis-courses/nginx/deploy/start.md @@ -0,0 +1 @@ +本场景提供龙蜥操作系统,提供nginx服务部署以及自定义HelloWorld页面体验。 \ No newline at end of file diff --git a/anolis-courses/nginx/deploy/step2.md b/anolis-courses/nginx/deploy/step2.md new file mode 100755 index 0000000..9cc25c5 --- /dev/null +++ b/anolis-courses/nginx/deploy/step2.md @@ -0,0 +1,10 @@ +```bash +dnf install nginx -y +systemctl status nginx +systemctl start nginx +# 防火墙配置 +systemctl status firewalld +firewall-cmd --list-ports +firewall-cmd --zone=public --add-port=80/tcp --permanent +firewall-cmd --reload +``` \ No newline at end of file diff --git a/anolis-courses/nginx/deploy/step3.md b/anolis-courses/nginx/deploy/step3.md new file mode 100755 index 0000000..3d0dae1 --- /dev/null +++ b/anolis-courses/nginx/deploy/step3.md @@ -0,0 +1,6 @@ +```bash +curl 127.0.0.1 + +# 网页访问 +http://xx.xx.xx.xx +``` \ No newline at end of file diff --git a/anolis-courses/nginx/deploy/step4.md b/anolis-courses/nginx/deploy/step4.md new file mode 100755 index 0000000..52c2576 --- /dev/null +++ b/anolis-courses/nginx/deploy/step4.md @@ -0,0 +1,24 @@ +```bash +cd /usr/share/nginx/html +mkdir helloworld +cd helloworld +# 创建helloworld.html,内容如下: + + + + + +

Hello World

+ + + +# 编辑/etc/nginx/nginx.conf文件,添加hello.html文件的location +# 在原有的内容: +error_page 404 /404.html; + location = /404.html { + } +# 上方添加如下内容: +location /hello.html { + root /usr/share/nginx/html/helloworld; + } +``` \ No newline at end of file diff --git a/anolis-courses/nginx/deploy/step5.md b/anolis-courses/nginx/deploy/step5.md new file mode 100755 index 0000000..3d19d4b --- /dev/null +++ b/anolis-courses/nginx/deploy/step5.md @@ -0,0 +1,3 @@ +```bash +systemctl restart nginx +``` \ No newline at end of file diff --git a/anolis-courses/nginx/deploy/step6.md b/anolis-courses/nginx/deploy/step6.md new file mode 100755 index 0000000..456f1f9 --- /dev/null +++ b/anolis-courses/nginx/deploy/step6.md @@ -0,0 +1,6 @@ +```bash +curl http://127.0.0.1:80/hello.html + +# 页面访问 +http://xx.xx.xx.xx:80/hello.html +``` \ No newline at end of file diff --git a/anolis-courses/nginx/deploy/step7.md b/anolis-courses/nginx/deploy/step7.md new file mode 100755 index 0000000..5a4a1a5 --- /dev/null +++ b/anolis-courses/nginx/deploy/step7.md @@ -0,0 +1,12 @@ +```bash +# 删除自定义界面 +rm -rf /usr/share/nginx/html/helloworld +# 停止nginx服务 +systemctl stop nginx +systemctl status nginx +# 卸载nginx +dnf -y remove nginx +# 清除防火墙规则 +firewall-cmd --zone=public --remove-port=80/tcp --permanent +firewall-cmd --reload +``` \ No newline at end of file diff --git a/anolis-courses/nginx/index.yaml b/anolis-courses/nginx/index.yaml new file mode 100755 index 0000000..4a5c23a --- /dev/null +++ b/anolis-courses/nginx/index.yaml @@ -0,0 +1,10 @@ +name: nginx +desc: 体验nginx服务 +type: course +total_time: 30min +level: beginner +chapters: + - name: deploy + desc: 部署nginx,并自定义HelloWorld + content: + live_time: 30min \ No newline at end of file -- Gitee