zoukankan      html  css  js  c++  java
  • nginx 1.15.10 前端代理转发 将多个地址,代理转发到一个地址和端口 多系统公用一个cookie 统一token

    nginx 1.15.10 前端代理转发 将多个地址,代理转发到一个地址和端口 多系统公用一个cookie 统一token

    注意:

    proxy_pass http://192.168.40.54:2233/xxxx_web/; (结尾有分号)
     
    重新加载的reload命令
    nginx.exe -s reload

    nginx 下载 https://nginx.org/en/download.html

    解压本地后 看 conf/nginx.conf

    打开后 在倒数第2行 加入

        include       nginx-xxxx.conf;

    就是单独写一个配置文件,不改写公共配置文件,当然也可以直接写在配置文件内

    小插曲:我本机应该是开了一个80端口,影射着一个目录,所以把配置文件的端口号从80改成8000了

    nginx-xxxx.conf

        server {
            listen       8888;
            server_name  localhost;
    
            #charset koi8-r;
    
            #access_log  logs/host.access.log  main;
    
            location /xxxx1_web {
              # 这个是平台的接口
               proxy_pass http://192.168.999.999:9999/xxxx1_web;
            }
        location /xxxx2_web {
          proxy_pass http://192.168.888.888:8999/xxxx2_web;
        }
            #error_page  404              /404.html;
    
            # redirect server error pages to the static page /50x.html
            #
            error_page   500 502 503 504  /50x.html;
            location = /50x.html {
                root   html;
            }
    
            # proxy the PHP scripts to Apache listening on 127.0.0.1:80
            #
            #location ~ .php$ {
            #    proxy_pass   http://127.0.0.1;
            #}
    
            # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
            #
            #location ~ .php$ {
            #    root           html;
            #    fastcgi_pass   127.0.0.1:9000;
            #    fastcgi_index  index.php;
            #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
            #    include        fastcgi_params;
            #}
    
            # deny access to .htaccess files, if Apache's document root
            # concurs with nginx's one
            #
            #location ~ /.ht {
            #    deny  all;
            #}
        }
    
    
        # another virtual host using mix of IP-, name-, and port-based configuration
        #
        #server {
        #    listen       8000;
        #    listen       somename:8080;
        #    server_name  somename  alias  another.alias;
    
        #    location / {
        #        root   html;
        #        index  index.html index.htm;
        #    }
        #}
    
    
        # HTTPS server
        #
        #server {
        #    listen       443 ssl;
        #    server_name  localhost;
    
        #    ssl_certificate      cert.pem;
        #    ssl_certificate_key  cert.key;
    
        #    ssl_session_cache    shared:SSL:1m;
        #    ssl_session_timeout  5m;
    
        #    ssl_ciphers  HIGH:!aNULL:!MD5;
        #    ssl_prefer_server_ciphers  on;
    
        #    location / {
        #        root   html;
        #        index  index.html index.htm;
        #    }
        #}

    最后回到解压的根目录 运行dos命令

    start nginx.exe

    代理就打开了,可以通过本机的localhost和端口号 看看服务是否开启,

    然后 在后面加入 目录名查看系统

  • 相关阅读:
    Manager Test and DAO
    07-图
    06-排序
    05-查找
    第04次作业-树
    第03次作业-栈和队列
    week-02 线性表
    week01—绪论
    使用promise封装el-form多个表单校验
    $slot受slot-scope影响,导致$slot中的key消失
  • 原文地址:https://www.cnblogs.com/pengchenggang/p/10608752.html
Copyright © 2011-2022 走看看