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;
                            }
            }

    }


  • 相关阅读:
    iOS:解决打包可能会出现环境错误问题
    iOS:关于self.perfrom(:_, with: afterDelay: )不执行问题
    docker容器中安装vi命令
    java-1 基础一
    java-0 重拾java
    柯里化函数的实现
    flex布局最后一行列表左对齐的N种方法
    【第一弹】微服务认证与授权企业级理解
    MySQL性能优化(慢查询日志、Explain执行计划、show profile、MySQL服务优化)
    MySQL锁详解
  • 原文地址:https://www.cnblogs.com/d9394/p/12033947.html
Copyright © 2011-2022 走看看