码迷,mamicode.com
首页 > 其他好文 > 详细

nginx之十三:搭建 nginx 反向代理用做内网域名转发

时间:2019-01-25 22:46:17      阅读:256      评论:0      收藏:0      [点我收藏+]

标签:服务器配置   localhost   process   nagios   real   name   eve   服务区   rect   

user www www;
worker_processes 1;
error_log logs/error.log;
pid logs/nginx.pid;
worker_rlimit_nofile 65535;
events {
  use epoll;
  worker_connections 65535;
}
http{
  include mime.types;
  default_type application/octet-stream;
  sendfile on;
  keepalive_timeout 65;
  gzip on;
  client_max_body_size 50m;
  client_body_buffer_size 256k;
  client_header_timeout 3m;
  client_body_timeout 3m;
  send_timeout 3m;
  proxy_connect_timeout 300s; #nginx跟后端服务区连接超时时间(代理时间超时)
  proxy_read_timeout 300s; #连接成功后,后端服务区响应时间(代理接收超时)
  proxy_buffer_size 64k; #设置代理服务器(nginx)保存用户头信息的缓冲区大小
  proxy_buffers 4 32k; #proxy_buffers缓冲区,网页平均在32k以下这样设置
  proxy_busy_buffers_size 64k; 
  proxy_temp_file_write_size 64; 
  proxy_ignore_client_abort on; 

upstream monitor_server {
  server 192.168.0.131:8090;
  server 192.168.0.132:80;
}
server {
  listen 80;
  server_name localhost;
  location / {
    root html;
    index index.html index.htm;
   }
  error_page 500 502 503 504 /50x.html;
  localtion =/50x.html {
    root html;
  }
}

server {
  listen 80;
  server_name nagios.xxx123.tk;
  localtion / {
    proxy_redirect off;
    proxy_set_header Host $host;
    proxy_set_header X-Real_IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_pass http://monitor_server;
  }
  access_log off;
  }
}

 

编辑反向代理服务器配置文件:

vim /usr/local/nginx/conf/reverse-proxy.conf

nginx之十三:搭建 nginx 反向代理用做内网域名转发

标签:服务器配置   localhost   process   nagios   real   name   eve   服务区   rect   

原文地址:https://www.cnblogs.com/charon2/p/10321997.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!