Skip to content

Commit

Permalink
forward proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
hsz1273327 committed Dec 4, 2020
1 parent ffe6f41 commit 4de14a9
Show file tree
Hide file tree
Showing 15 changed files with 14 additions and 318 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# nginx使用serverpush
# 正向代理示例

这个例子托管的前端页面使用的是我的[javascript攻略](https://tutorialforjavascript.github.io/)[前端概览](https://tutorialforjavascript.github.io/web%E5%89%8D%E7%AB%AF%E6%8A%80%E6%9C%AF/%E5%89%8D%E7%AB%AF%E6%A6%82%E8%A7%88/)一篇的[helloworld项目](https://github.com/TutorialForJavascript/frontend-basic/tree/master/code/C0)中的成品
这个例子代理了百度到本地的5000端口

## 依赖

Expand All @@ -9,6 +9,5 @@

## 使用

+ 这个静态网页托管的配置在`config/conf.d/static.d/static.conf`
+ 执行容器可以在`该项目根目录下`打开`terminal`使用`docker-compose up -d`
+ 在浏览器的控制台的netxwork中可以看到`style.css`的initiator是`push`过来的
+ 浏览器中打开页面`https://localhost:5000`可以看到百度的页面
31 changes: 0 additions & 31 deletions clientkey/client-cert.pem

This file was deleted.

Binary file removed clientkey/client-cert.pfx
Binary file not shown.
51 changes: 0 additions & 51 deletions clientkey/client-key.pem

This file was deleted.

8 changes: 8 additions & 0 deletions config/conf.d/httpproxy.d/forward_proxy.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
server {
resolver 114.114.114.114; #指定DNS服务器IP地址
listen 5000;
server_name localhost;
location / {
proxy_pass http://www.baidu.com; #设定代理服务器的协议和地址
}
}
27 changes: 0 additions & 27 deletions config/conf.d/static.d/https.conf

This file was deleted.

2 changes: 1 addition & 1 deletion config/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ http {

#gzip on;
client_max_body_size 2000m;
include /etc/nginx/conf.d/static.d/*.conf;
include /etc/nginx/conf.d/httpproxy.d/*.conf;
}
34 changes: 0 additions & 34 deletions crt/ca.crt

This file was deleted.

34 changes: 0 additions & 34 deletions crt/ca.pem

This file was deleted.

31 changes: 0 additions & 31 deletions crt/server-cert.pem

This file was deleted.

51 changes: 0 additions & 51 deletions crt/server-key.pem

This file was deleted.

6 changes: 2 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ services:
http-static:
image: nginx:alpine
ports:
- 8443:8443
- 8080:8080
- 5000:5000
logging:
options:
max-size: "10m"
max-file: "3"
volumes:
- ./config/nginx.conf:/etc/nginx/nginx.conf
- ./config/conf.d:/etc/nginx/conf.d
- ./static:/usr/share/nginx/html
- ./crt:/data/crt

17 changes: 0 additions & 17 deletions static/index.html

This file was deleted.

20 changes: 0 additions & 20 deletions static/index.js

This file was deleted.

13 changes: 0 additions & 13 deletions static/style.css

This file was deleted.

0 comments on commit 4de14a9

Please sign in to comment.