做反向代理的配置文件最好单独创建一个文件,然后在主配置文件中使用 include nginx-test.config;  这样的方式来导入。

配置代码如下:

  1. ## Basic reverse proxy server ##
  2. ## Apache backend for www.baidu.com ##
  3. upstream henushang  {
  4. server www.baidu.com; # 或者ip:port这样形式也是可以的
  5. }
  6. ## Start www.baidu.com ##
  7. server {
  8. listen 80;
  9. server_name  www.henushang.cn;#监听的域名
  10. access_log  logs/henushang.access.log;
  11. error_log  logs/henushang.error.log;
  12. root   html;
  13. index  index.html index.htm index.php;
  14. ## send request back to apache ##
  15. location / {
  16. proxy_pass  http://henushang;#与上面的upstream名字相对应
  17. #Proxy Settings
  18. proxy_redirect     off;
  19. proxy_set_header   Host             $host;
  20. proxy_set_header   X-Real-IP        $remote_addr;
  21. proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
  22. proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
  23. proxy_max_temp_file_size 0;
  24. proxy_connect_timeout      90;
  25. proxy_send_timeout         90;
  26. proxy_read_timeout         90;
  27. proxy_buffer_size          4k;
  28. proxy_buffers              4 32k;
  29. proxy_busy_buffers_size    64k;
  30. proxy_temp_file_write_size 64k;
  31. }
  32. }

最新文章

  1. POJ 1163 The Triangle(简单动态规划)
  2. Nginx 遇到的问题
  3. 使用BootStrap制作用户登录UI
  4. 在mac上安装pydev for eclipse时,在eclipse的Preferences中无法显示出来的解决方法
  5. Load Balancing 折半枚举大法好啊
  6. mac终端命令简介
  7. java多态 -- 猫狗案列
  8. SpringMVC10数据验证
  9. (转)使用DataTime这个类来获取当前的时间
  10. Caused by: java.lang.ClassNotFoundException: javax.transaction.TransactionManager
  11. Linux服务器SSH无法通过DSA证书登录的解决方法
  12. Linux 文件及目录管理命令基础
  13. 使用idea对spring boot项目打jar和war包[文件]
  14. [hdu P4334] Trouble
  15. [cloud][sdn] network namespace
  16. manifest.xml微擎系统模块的安装文件内容
  17. bzoj2342: [Shoi2011]双倍回文 pam
  18. [UE4]把枪打飞addImpulse
  19. nodeclub
  20. 【转】浅谈React、Flux 与 Redux

热门文章

  1. 基于AngularJS/Ionic框架开发的性能优化
  2. META 标签的使用
  3. Qt绘制异形窗体
  4. Linux RedHat无法安装软件问题(No package gcc available. Nothing to do)
  5. Java中的队列:java.util.Queue接口
  6. StringBuilder的Append()方法会比+=效率高
  7. MYSQL数据库主主同步实战
  8. $.ligerDialog 操作
  9. 微信支付配置信息,JSAPI接口,H5调用微信js接口支付,微信公众号支付
  10. EXTJS 资料 Ext.Ajax.request 获取返回数据