• nginx 生产中配置记录


     1 root@ubuntu:/etc/nginx/sites-enabled# cat nginx_universal.conf 
     2 upstream manager  {
     3     #ip_hash;
     4     server 10.200.47.69:9100;
     5     server 10.200.47.70:9100;
     6 }
     7 
     8 upstream portia  {
     9     ip_hash;
    10 
    11     server 10.200.47.69:9010;
    12     server 10.200.47.69:9020;
    13     server 10.200.47.70:9010;
    14     server 10.200.47.70:9020;
    15 }
    16 
    17 
    18 server {
    19     listen 9000;
    20     server_name crawler.ckcest.cn;
    21     charset utf-8;
    22 
    23     location /chatbot/ {
    24         proxy_set_header Host $host;
    25         proxy_pass  http://118.190.49.72:8888/;
    26     }
    27     location / {
    28         proxy_set_header        Host            $host;
    29         proxy_set_header X-Real-IP $remote_addr;
    30         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    31         proxy_pass  http://manager;
    32     }
    33    location /crawler_board/ {
    34     proxy_set_header Host $host;
    35         proxy_set_header X-Real-IP $remote_addr;
    36         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    37       proxy_pass http://10.200.47.71:8200/;
    38    }
    39    location /api/analysis/ {
    40     proxy_set_header Host $host;
    41     proxy_pass http://10.200.47.71:8200/api/analysis/;    
    42   }
    43         
    44 }
    45 server {
    46     listen 9001;
    47     server_name  vspider.ckcest.cn;   
    48     charset utf-8;
    49     location / {
    50     proxy_redirect          off;
    51         proxy_set_header        Host            $host:$server_port;
    52         proxy_set_header        X-Real-IP       $remote_addr;
    53         proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    54     proxy_pass  http://portia;
    55         
    56    } 
    57    location /ws {
    58         proxy_pass  http://portia;
    59 
    60     # WebSocket support
    61     proxy_http_version 1.1;
    62     proxy_buffering    off;
    63     proxy_set_header Upgrade $http_upgrade;
    64     proxy_set_header Connection "upgrade";
    65     }
    66 }
    1. 缺少/ 不能访问设置的地址
    proxy_pass http://10.200.47.71:8200/; 后面需要加 / 才能访问
    10.200.47.69本机ip
    10.200.47.69:9000/crawler_borad/
    2. 地址能访问但是不能加载出页面;
    原因:缺少

         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    参考 :http://www.cnblogs.com/kevingrace/p/6566119.html 

  • 相关阅读:
    一个兼容各浏览器的阻止冒泡的StopPropagation解决方案
    百度面试题:从输入URL到显示网页,后台发生了什么?
    三角形面积公式S=(1/2)absinC的证明
    正弦定理证明(方法二)
    高中数学总结(高一上半部分内容)
    解析几何部分
    正弦定理的证明(方法一)
    平面向量的坐标表示
    将三角函数值转换为角度
    余弦定理方法证明
  • 原文地址:https://www.cnblogs.com/Honeycomb/p/10524977.html
Copyright © 2020-2023  润新知