zoukankan      html  css  js  c++  java
  • nginx笔记

    1、直接返回来访IP

    location /ip {

      default_type text/plain;

      return 200 $remote_addr;

    }

    2、流转发及写日志、开启websocket:

          log_format  stream  '$remote_addr ($remote_user) $time_local' ;

            map $http_upgrade $connection_upgrade {
                    default upgrade;
                    ''      close;
            }
            map $uri $log_stream_user {
                    default 0;
                    "~SND" 1;
            }

    stream {
        server {
            listen 15678;
            proxy_pass 192.168.1.99:1234;
        }
            server {
                            listen 8073;
                            access_log /var/log/nginx/access_8073.log stream buffer=1k flush=5s if=$log_stream_user;
                            location / {
                                            proxy_pass http://192.168.1.1:8073;
                                            proxy_http_version 1.1;
                                            proxy_set_header Upgrade $http_upgrade;
                                            proxy_set_header Connection "upgrade";
                                            auth_basic "Wellcome to visit ......";
                                            auth_basic_user_file htpasswd;
                            }
                            location ^~ /admin {
                                            deny all;
                            }
            }

    }


  • 相关阅读:
    TinyCMips
    C++坑点集合
    2017,不能再咸鱼了
    浅谈C语言变量声明的解析
    独自handle一个数据库大程有感
    Async Programming
    04python 中的各种推导式(python函数)
    03python 迭代器与生成器(python函数)
    02python 装饰器(python函数)
    01python 中的函数与函数式编程(python函数)
  • 原文地址:https://www.cnblogs.com/d9394/p/12033947.html
Copyright © 2011-2022 走看看