博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
配置 实现nginx 简单正向代理
阅读量:2397 次
发布时间:2019-05-10

本文共 842 字,大约阅读时间需要 2 分钟。

1.  学习测试阶段,未避免破坏 nginx原有的配置文件,可在与 nginx.conf 同目录下创建一个新的文件----proxy.

proxy 文件内容如下:

server {    listen      8099;    server_name  localhost;    location  /  {          #请求的主机域名;         # proxy_set_header Host $host;          #转的目标IP;         # proxy_set_header X-Real-IP $remote_addr;          #转发的目标          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;          #禁止缓冲          proxy_buffering off;          proxy_pass http://192.168.2.3/guide_query.action; # http://www.baidu.com;  #  只保留此句足以,访问内部服务器更直观明显,写百度之类的网址也可            }     }
2. 把proxy 文件与 nginx.conf文件关联到一起。

即 在nginx.conf 中的  http 节点下添加一句:

include proxy;
部分 nginx.conf 文件,如下:

events {    worker_connections  1024;}http {    include proxy;    include       mime.types;    default_type  application/octet-stream;

3. 重新启动 nginx 服务

在浏览器地址栏中输入:

http://localhost:8099/
即可。

转载地址:http://qffob.baihongyu.com/

你可能感兴趣的文章
容器化RDS—计算存储分离架构下的“Split-Brain”
查看>>
Oracle压缩黑科技(二)—压缩数据的修改
查看>>
挽救DG中主库的nologging操作的块
查看>>
Oracle Memory Management and HugePage (连载三)
查看>>
深度揭秘:秒级数据库备份恢复云平台—QBackup的五大优势
查看>>
Latch导致MySQL Crash
查看>>
容器化RDS:PersistentLocalVolumes和VolumeScheduling
查看>>
关于legacy system中使用bind variables(zt)
查看>>
mysql执行命令报segmentation fault 错误
查看>>
hdparm测试磁盘sequential IO简单测试
查看>>
块空间释放与压缩
查看>>
在sqlplus交互环境下测试存储过程
查看>>
RTFM("Read The Fucking Manual")的意思(zt)
查看>>
nvl, nvl2, nullif
查看>>
rsync的安全设定(zt)
查看>>
MySQL安全性指南
查看>>
about histogram(2)
查看>>
about histogram(1)
查看>>
批量检查主机是否可达的ping脚本.
查看>>
kudzu命令查看及设置网卡等硬件信息
查看>>