• nginx配置location多级路径访问


      我原本项目访问路径是:

    https://域名/项目名称/

      需求是在上述路径不动的基础上,添加一个路径如下:

    https://域名/A/项目名称/

    方法是在443代理下添加如下:ipport、项目名称替换成自己的即可

            location /A/projectName {
                proxy_pass http://127.0.0.1:80/项目名称;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                client_max_body_size 10m;
                client_body_buffer_size 128k;
                proxy_connect_timeout 90;
                proxy_send_timeout 90;
                proxy_read_timeout 90;
                proxy_buffer_size 4k;
                proxy_buffers 4 32k;
                proxy_busy_buffers_size 64k;
                proxy_temp_file_write_size 64k;
            }

    关键点是proxy_pass,当我设置成upstream server的时候无论怎么设置都无法正常工作。正常设置如下:

        upstream myserver{
           server 127.0.0.1:80;
        }
            location /naire2 {
                proxy_pass http://myserver;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                client_max_body_size 10m;
                client_body_buffer_size 128k;
                proxy_connect_timeout 90;
                proxy_send_timeout 90;
                proxy_read_timeout 90;
                proxy_buffer_size 4k;
                proxy_buffers 4 32k;
                proxy_busy_buffers_size 64k;
                proxy_temp_file_write_size 64k;
            }
  • 相关阅读:
    对协程的一些理解
    JUC中Lock和ReentrantLock介绍及源码解析
    JUC中AQS简介
    Executor框架简介
    CyclicBarrier简介
    CountDownLatch简介
    Semaphore简介
    ThreadPoolExecutor简介
    AtomicInteger简介
    synchronized和volatile简介
  • 原文地址:https://www.cnblogs.com/yanan7890/p/13446379.html
Copyright © 2020-2023  润新知