# 前言
记录一下 Docker 部署 Nginx 反代和简单的 nginx 反代配置
# 参考链接
- https://www.m6y.cc/archives/3002.html
# 创建反代的配置文件
| |
| mkdir proxy && cd proxy |
| |
| mkdir conf.d |
| |
| vi conf.d/default.conf |
default.conf
| server { |
| listen 80; |
| server_name 127.0.0.1; |
| |
| client_max_body_size 0; |
| proxy_max_temp_file_size 0; |
| proxy_buffering off; |
| proxy_request_buffering off; |
| |
| location ^~ / |
| { |
| proxy_pass https://node.aapanel.com; |
| proxy_set_header X-Real-IP $remote_addr; |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| proxy_set_header REMOTE-HOST $remote_addr; |
| proxy_set_header Upgrade $http_upgrade; |
| proxy_http_version 1.1; |
| |
| |
| |
| |
| proxy_set_header Host node.aapanel.com; |
| |
| |
| proxy_ssl_name node.aapanel.com; |
| proxy_ssl_server_name on; |
| |
| } |
| } |
# 执行 Nginx Docker 容器命令
| |
| docker run -d --restart=unless-stopped --network host -v $PWD/conf.d:/etc/nginx/conf.d --name=proxy nginx:mainline-alpine3.18-slim |