diff --git a/anolis-courses/nginx/deploy/index.yaml b/anolis-courses/nginx/deploy/index.yaml index 59b03b34f13d8d432ad86a8b61cb7cee0c8b3633..a919e6d63d5cc058b29d1c03cd5088c9761f7f77 100755 --- a/anolis-courses/nginx/deploy/index.yaml +++ b/anolis-courses/nginx/deploy/index.yaml @@ -3,7 +3,7 @@ desc: 部署nginx,并自定义HelloWorld image: Anolis OS 8.4 ANCK 64位 live_time: 30min machine: x86_64-2c4g -max_clients: 1 +max_clients: 5 details: steps: start: start.md diff --git a/anolis-courses/nginx/deploy/step2.md b/anolis-courses/nginx/deploy/step2.md index 9cc25c571102bf983043bb7b350efdf55a127d80..aa53869ddba73c556e5ba3ac76f7a52fd7e393ac 100755 --- a/anolis-courses/nginx/deploy/step2.md +++ b/anolis-courses/nginx/deploy/step2.md @@ -1,10 +1,17 @@ -```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 +1. 安装nginx: + +[[ dnf install nginx -y ]] + +2. 启动nginx服务 + +[[ systemctl start nginx ]] + +3. 配置防火墙 + +[[ 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 index 3d0dae14e86b572c68aac8c9798c52c3dadfbf31..dcbb3b0b18b61172d9f5c0bb7ae7f527c5dc36e1 100755 --- a/anolis-courses/nginx/deploy/step3.md +++ b/anolis-courses/nginx/deploy/step3.md @@ -1,6 +1,12 @@ -```bash -curl 127.0.0.1 +1. 本地访问 -# 网页访问 -http://xx.xx.xx.xx -``` \ No newline at end of file +[[ curl 127.0.0.1 ]] + +2. 网页访问 + +通过如下方式获取公网ip: + +[[ curl myip.ipip.net ]] + +获取到公网ip之后,通过浏览器输入ip访问: +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 index 52c2576b228b4f549e7634e7c47921d23e9eff0c..6fa68b2fe1769efb196ac33eb25ffebacc115b2f 100755 --- a/anolis-courses/nginx/deploy/step4.md +++ b/anolis-courses/nginx/deploy/step4.md @@ -1,8 +1,12 @@ -```bash -cd /usr/share/nginx/html -mkdir helloworld -cd helloworld -# 创建helloworld.html,内容如下: +1. 添加helloworld页面 + +[[ cd /usr/share/nginx/html ]] +[[ mkdir -p helloworld ]] +[[ cd helloworld ]] + +使用vim编辑hello.html,内容如下: + +``` @@ -11,13 +15,22 @@ cd helloworld

Hello World

+``` + +2. 修改nginx配置文件 -# 编辑/etc/nginx/nginx.conf文件,添加hello.html文件的location -# 在原有的内容: +编辑/etc/nginx/nginx.conf文件,添加hello.html文件的location +在原有的内容: + +``` error_page 404 /404.html; location = /404.html { } -# 上方添加如下内容: +``` + +上方添加如下内容: + +``` location /hello.html { root /usr/share/nginx/html/helloworld; } diff --git a/anolis-courses/nginx/deploy/step5.md b/anolis-courses/nginx/deploy/step5.md index 3d19d4b2989a062714991b3493c8c6ee3a7a9d21..d242032938eaa149c294d30ceb4c9d0d564a1b0f 100755 --- a/anolis-courses/nginx/deploy/step5.md +++ b/anolis-courses/nginx/deploy/step5.md @@ -1,3 +1 @@ -```bash -systemctl restart nginx -``` \ No newline at end of file +[[ systemctl restart nginx ]] diff --git a/anolis-courses/nginx/deploy/step6.md b/anolis-courses/nginx/deploy/step6.md index 456f1f9a6fef7df34f1d61acda9ff3779846f31a..12c29d3a3f8645b1d7afafbe6ebbef2b639b4a07 100755 --- a/anolis-courses/nginx/deploy/step6.md +++ b/anolis-courses/nginx/deploy/step6.md @@ -1,6 +1,11 @@ -```bash -curl http://127.0.0.1:80/hello.html +1. 本地访问 -# 页面访问 -http://xx.xx.xx.xx:80/hello.html -``` \ No newline at end of file +[[ curl http://127.0.0.1:80/hello.html ]] + +2. 页面访问 + +通过如下方式获取公网ip: +[[ curl myip.ipip.net ]] + +获取到公网ip后,使用浏览器访问。 +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 index 5a4a1a53736d027b779f75dacde84c8e3ae15ef1..29fbd6f6afec1c2d7d3e08a30685cf7fc64b1556 100755 --- a/anolis-courses/nginx/deploy/step7.md +++ b/anolis-courses/nginx/deploy/step7.md @@ -1,12 +1,13 @@ -```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 +1. 删除自定义界面 +[[ rm -rf /usr/share/nginx/html/helloworld ]] + +2. 停止nginx服务 +[[ systemctl stop nginx ]] + +3. 卸载nginx +[[ dnf -y remove nginx ]] + +4. 清除防火墙规则 +防火墙服务没开启无需执行。 +[[ firewall-cmd --zone=public --remove-port=80/tcp --permanent ]] +[[ firewall-cmd --reload ]]