一 案例一
1.在目录/data02/dky-html新建一个静态文件
[root@host-172-16-26-21 dky-html]# ls
test.html
[root@host-172-16-26-21 dky-html]# pwd
/data02/dky-html
[root@host-172-16-26-21 dky-html]#
2.nginx.cnf的配置
location /test {
alias /data02/dky-html;
#index test.html;
}

3.重启nginx
[root@host-172-16-26-21 nginx]# nginx -s reload
4. 访问地址
1.未代理前:http://172.16.26.21/test.html
2.nginx代理后: http://172.16.26.21/test/test.html

二 案例二
1.nginx的配置文件

2. 资源存储位置:

3.访问地址
1.未代理前:http://140.210.90.167:8089/#/overview
2.代理后:http://140.210.90.167:8089/pds/#/overview

Nginx静态文件代理配置
本文介绍如何通过Nginx配置实现静态文件的代理访问,包括创建静态文件、配置Nginx代理规则及访问路径变化等内容。

3096

被折叠的 条评论
为什么被折叠?



