添加一个nginx代理静态页面的示例

This commit is contained in:
taynpg 2024-03-08 19:13:12 +08:00
parent 8cbcae3be7
commit 4bb8dd6e4a

20
web.txt
View File

@ -15,7 +15,7 @@ server {
}
}
nginx http 强制重定向到https
新建一个server:
新建一个server (Server 在 http {} 里面):
server {
listen 80;
server_namewww.sinxmiao.cn;
@ -24,3 +24,21 @@ server {
}
2.网页中插入一个备案号示例:
<a class="item" href="https://beian.miit.gov.cn/">xx号-1</a>
3.记一次cppreference nginx设置
cppreference目录结构如下:
root -->
common/xxx.js
zh/index.html
server {
listen 80;
server_name 192.168.137.66;
location / {
root /home/ypi/document/cppreference/reference/zh;
index index.html;
try_files $uri $uri/ =404;
}
这里的 /common/如果不知道填什么,可以浏览器查看 server_name 后面直接跟的路径。
location /common/ {
root /home/ypi/document/cppreference/reference/;
}
}